home *** CD-ROM | disk | FTP | other *** search
/ SGI Developer Toolbox 6.1 / SGI Developer Toolbox 6.1 - Disc 1.iso / toolbox / documents / Dwarf / dwarf.v2.mm < prev    next >
Text File  |  1996-11-11  |  236KB  |  7,703 lines

  1. '\"#ident    "%W%"
  2. '\" $Source: /toolbox/src/irix5/documents/Dwarf/RCS/dwarf.v2.mm,v $
  3. '\"
  4. '\" $Revision: 1.1 $
  5. '\"
  6. '\" DESCRIPTION
  7. '\"
  8. '\"    Requirements for 
  9. '\"
  10. '\" COMPILATION
  11. '\"
  12. '\"    pic file.mm | tbl | troff -mm
  13. '\"
  14. '\"    local mileage may vary
  15. '\"
  16. '\" AUTHOR
  17. '\"
  18. '\"    UNIX International Programming Languages SIG
  19. '\"
  20. '\" COPYRIGHT
  21. '\"
  22. '\"    Copyright (c) 1992,1993, UNIX International
  23. '\"
  24. '\"    Permission to use, copy, modify, and distribute this documentation for
  25. '\"    any purpose and without fee is hereby granted, provided that the above
  26. '\"    copyright notice appears in all copies and that both that copyright
  27. '\"    notice and this permission notice appear in supporting documentation,
  28. '\"    and that the name UNIX International not be used in advertising or
  29. '\"    publicity pertaining to distribution of the software without specific,
  30. '\"    written prior permission.  UNIX International makes no representations
  31. '\"    about the suitability of this documentation for any purpose.  It is
  32. '\"    provided "as is" without express or implied warranty.
  33. '\"    
  34. '\"    UNIX INTERNATIONAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
  35. '\"    DOCUMENTATION, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
  36. '\"    FITNESS.  IN NO EVENT SHALL UNIX INTERNATIONAL BE LIABLE FOR ANY
  37. '\"    SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
  38. '\"    RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
  39. '\"    CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
  40. '\"    CONNECTION WITH THE USE OR PERFORMANCE OF THIS DOCUMENTATION.
  41. '\"    
  42. '\"    NOTICE:
  43. '\"    
  44. '\"    UNIX International is making this documentation available as a
  45. '\"    reference point for the industry.  While UNIX International believes
  46. '\"    that this specification is well defined in this first release of the
  47. '\"    document, minor changes may be made prior to products meeting this
  48. '\"    specification being made available from UNIX System Laboratories or 
  49. '\"    UNIX International members.
  50. '\"
  51. '\" $Log: dwarf.v2.mm,v $
  52. .\" Revision 1.1  1996/03/17  23:16:27  dave
  53. .\" folding in 6.2-based contents of compiler_dev.src.dwarf subsystem
  54. .\"
  55. .\" Revision 1.1  1994/05/18  18:50:42  davea
  56. .\" Initial revision
  57. .\"
  58. '\"
  59. '\"     Abbrevs for funny typeset words
  60. .pl-0.25i
  61. .ds aX U\s-2NIX\s+2
  62. .ds iX \*(aX International
  63. .ds uL \s-2AT&T\ USL\s+2
  64. '\"
  65. '\"  uI should be set to 1 if the publication and copyright page is needed.
  66. .nr uI 1
  67. '\"
  68. '\"     Make the appropriate replacements in this section!
  69. '\"
  70. '\"     Set the ND date to the current date.
  71. '\"     tT is the formal document title
  72. '\"     tP is the name of the Project (if appropriate)
  73. '\"     tD is the short document title
  74. '\"     tE is the work group name (may be the same as the project name)
  75. .ds tT DWARF Debugging Information Format 
  76. .ds tP 
  77. '\"             Document name (i.e., without project name)
  78. .ds tD DWARF Debugging Information Format
  79. .ds tE Programming Languages SIG
  80. '\"
  81. '\"     Define headers and footers macro
  82. '\"
  83. .ds fA Revision: 2.0.0
  84. '\"
  85. '\"     fB null to remove page numbers on cover page
  86. .ds fB
  87. .ds fC July 27, 1993
  88. .ds fE Industry Review Draft
  89. .ds fF \*(tD
  90. .PH "''''"
  91. .PF "''\*(fE''"
  92. .tr ~
  93. .SA 1
  94. .S 10
  95. .nr Ej 1
  96. .nr Hs 5
  97. .nr Hu 1
  98. .nr Hb 5
  99. .ds HP +2 +2 +1 +0 +0 +0 +0
  100. .ds HF 3 3 3 3 3 1 1
  101. .if n .ds HF 1 1 1 1 1 1 1 1
  102. '\"
  103. '\"     First page, print title and authors
  104. '\"
  105. .S +4
  106. .DS C
  107.  
  108.  
  109.  
  110.  
  111.  
  112.  
  113. \fB\*(tT
  114.  
  115. \s-2\*(tP\s+2\fP
  116.  
  117. .DE
  118. .S
  119. .sp 3i
  120. \*(iX
  121. .br
  122. \*(tE
  123. .br
  124. \*(fA (\*(fC)
  125. .SK
  126. .if \n(uI\{ 
  127. .DS C
  128. .in -.25i
  129. .B "Published by:"
  130. .R
  131.  
  132. \*(iX
  133. Waterview Corporate Center
  134. 20 Waterview Boulevard
  135. Parsippany, NJ  07054
  136.  
  137. for further information, contact:
  138. Vice President of Marketing
  139.  
  140. Phone:    +1 201-263-8400
  141. Fax:    +1 201-263-8401
  142. .DE
  143. .P
  144. Copyright \(co 1992, 1993 \*(iX, Inc.
  145. .P
  146. Permission to use, copy, modify, and distribute this
  147. documentation for any purpose and without fee is hereby granted, provided
  148. that the above copyright notice appears in all copies and that both that
  149. copyright notice and this permission notice appear in supporting
  150. documentation, and that the name \*(iX not be used in 
  151. advertising or publicity pertaining to distribution of the software 
  152. without specific, written prior permission.  \*(iX makes
  153. no representations about the suitability of this documentation for any 
  154. purpose.  It is provided "as is" without express or implied warranty.
  155. .P
  156. UNIX INTERNATIONAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS DOCUMENTATION, 
  157. INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.  IN NO 
  158. EVENT SHALL UNIX INTERNATIONAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR 
  159. CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF 
  160. USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR 
  161. OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 
  162. PERFORMANCE OF THIS DOCUMENTATION.
  163. .sp 2l
  164. .if \n(uI\{
  165. NOTICE:
  166. .P
  167. \*(iX is making this documentation available as a
  168. reference point for the industry.  
  169. While \*(iX believes that this specification is well
  170. defined in this first release of the document,
  171. minor changes may be made prior to products meeting this specification
  172. being made available from \*(aX System Laboratories or \*(iX members.
  173. .sp 1l \}
  174. Trademarks:
  175. .P
  176. Intel386 is a trademark of Intel Corporation.
  177. .br
  178. \*(aX\(rg is a registered trademark of \*(aX System Laboratories 
  179. in the United States and other countries.
  180. .br
  181. .OH "'''\s10\\\\*(tE\s0'"
  182. .EH "'\s10\\\\*(tD\s0'''"
  183. .SK
  184. '\".VM 0 2
  185. .PF "''\s10\\\\*(fE\s0''"
  186. .OF "'\s10\\\\*(fA'\\\\*(fB'\\\\*(fC\s0'"
  187. .EF "'\s10\\\\*(fA'\\\\*(fB'\\\\*(fC\s0'"
  188. '\" -----------------------------------------------------------------------
  189. '\".
  190. '\"     Reset page numbers
  191. '\"
  192. .nr P 1
  193. .nr % 1
  194. '\"
  195. '\"     Define headers and footers
  196. '\"
  197. .FH
  198. '\"     Turn on the page numbering in the footers
  199. .ds fB Page %
  200. '\"
  201. '\"     MACROEND
  202. '\"
  203. .if n .fp 2 R
  204. .if n .fp 3 R
  205. .tr ~  
  206. \fR
  207. .S 11
  208. .SA 1
  209. .tr ~
  210. .OP
  211. .ds | |
  212. .ds ~ ~
  213. .ds ' '
  214. .if t .ds Cw \&\f(CW
  215. .if n .ds Cw \fB
  216. .de Cf        \" Place every other arg in Cw font, beginning with first
  217. .if \\n(.$=1 \&\*(Cw\\$1\fP
  218. .if \\n(.$=2 \&\*(Cw\\$1\fP\\$2
  219. .if \\n(.$=3 \&\*(Cw\\$1\fP\\$2\*(Cw\\$3\fP
  220. .if \\n(.$=4 \&\*(Cw\\$1\fP\\$2\*(Cw\\$3\fP\\$4
  221. .if \\n(.$=5 \&\*(Cw\\$1\fP\\$2\*(Cw\\$3\fP\\$4\*(Cw\\$5\fP
  222. .if \\n(.$=6 \&\*(Cw\\$1\fP\\$2\*(Cw\\$3\fP\\$4\*(Cw\\$5\fP\\$6
  223. .if \\n(.$=7 \&\*(Cw\\$1\fP\\$2\*(Cw\\$3\fP\\$4\*(Cw\\$5\fP\\$6\*(Cw\\$7\fP
  224. .if \\n(.$=8 \&\*(Cw\\$1\fP\\$2\*(Cw\\$3\fP\\$4\*(Cw\\$5\fP\\$6\*(Cw\\$7\fP\\$8
  225. .if \\n(.$=9 \&\*(Cw\\$1\fP\\$2\*(Cw\\$3\fP\\$4\*(Cw\\$5\fP\\$6\*(Cw\\$7\fP\\$8\*(Cw
  226. ..
  227. '\" macros used by index generating tool
  228. .deIX
  229. .ie '\\n(.z'' .tm .Index: \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9    \\n%
  230. .el \\!.ix \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
  231. ..
  232. .deix
  233. .ie '\\n(.z'' .tm .Index: \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9    \\n%
  234. .el \\!.ix \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
  235. ..
  236. .ta .5i +.5i +.5i +.5i +.5i +.5i +.5i +.5i
  237. .HU "FOREWORD"
  238. This document specifies the second generation of symbolic debugging
  239. information based on the DWARF format that 
  240. has been developed by the \*(iX
  241. Programming Languages Special Interest Group (SIG).
  242. It is being circulated for industry review.  
  243. The first version of the DWARF specification was published
  244. by \*(iX in January, 1992.  The current version adds significant
  245. new functionality, but its main thrust is to achieve a much
  246. denser encoding of the DWARF information.  Because of the new
  247. encoding, DWARF Version 2 is not binary compatible with
  248. DWARF Version 1.
  249. .P 
  250. At this point, the SIG believes that this document sufficiently
  251. supports the debugging needs of C, C++, FORTRAN 77, 
  252. Fortran90, Modula2 and Pascal, and we have
  253. released it for public comment.  We will accept comments on this
  254. document until September 30, 1994.  Comments may be directed via email
  255. to the SIG mailing list (plsig@ui.org).  If you are unable
  256. to send email, paper mail, FAX, or machine readable copy 
  257. on \*(aX, MS-DOS, or Macintosh compatible media can be 
  258. sent to \*(iX at the address listed below, 
  259. and will be forwarded to the SIG.
  260. .SP
  261. .SP
  262. .SP
  263. .in +20
  264. UNIX International
  265. .br
  266. Waterview Corporate Center
  267. .br
  268. 20 Waterview Boulevard
  269. .br
  270. Parsippany, NJ 07054
  271. .br
  272. Phone:    +1 201-263-8400
  273. .br
  274. Fax:    +1 201-263-8401
  275. .br
  276. .in -20
  277. .nr H1 0
  278. .OP
  279. .H 1 "INTRODUCTION"
  280. \fR
  281. This document defines the format for the information generated by
  282. compilers, assemblers and linkage editors that is necessary for symbolic,
  283. source-level debugging.  The debugging information format does not favor the
  284. design of any compiler or debugger.  Instead, the goal is to create a method of
  285. communicating an accurate picture of the source program to any debugger in a
  286. form that is economically extensible to different languages while retaining
  287. backward compatibility.
  288. .P
  289. The design of the debugging information format is open-ended, allowing for the
  290. addition of new debugging information to accommodate new languages or
  291. debugger capabilities while remaining compatible with other languages or
  292. different debuggers.
  293. .H 2 "Purpose and Scope"
  294. The debugging information format described in this document is designed to
  295. meet the symbolic, source-level debugging needs of 
  296. different languages in a unified fashion by
  297. requiring language independent debugging information whenever possible.
  298. .IX C++ %caa
  299. .IX virtual functions
  300. .IX Fortran
  301. Individual needs, such as C++ virtual functions or Fortran common blocks are
  302. accommodated by creating attributes that are used only for those
  303. languages.  The \*(iX \*(tE believes 
  304. that this document sufficiently covers the 
  305. .IX languages
  306. debugging information needs of C, C++, FORTRAN77, Fortran90, 
  307. Modula2 and Pascal.
  308. .IX C %c
  309. .IX Modula2
  310. .IX Pascal
  311. .IX FORTRAN77
  312. .IX Fortran90
  313. .P
  314. This document describes DWARF Version 2, the second generation of debugging
  315. .IX Version 2
  316. information based on the DWARF format.  While DWARF Version 2 provides
  317. new debugging information not available in Version 1, the primary focus
  318. of the changes for Version 2 is the representation of the information,
  319. rather than the information content itself.  The basic structure of 
  320. the Version 2 format remains as in Version 1: the debugging information
  321. is represented as a series of debugging information entries, each containing
  322. one or more attributes (name/value pairs). 
  323. .IX debugging information entries
  324. .IX attributes
  325. The Version 2 representation, however,
  326. is much more compact than the Version 1 representation.
  327. .IX Version 1
  328. In some cases, this greater density has been achieved at the expense
  329. of additional complexity or greater difficulty in producing and processing
  330. the DWARF information.  We believe that the reduction in I/O and in
  331. memory paging should more than make up for any increase in processing time.
  332. .P
  333. Because the representation of information has changed from Version 1 to
  334. Version 2, Version 2 DWARF information is not binary compatible
  335. .IX compatibility
  336. with Version 1 information.  To make it easier for consumers to
  337. support both Version 1 and Version 2 DWARF information, the Version
  338. 2 information has been moved to a different object file section,
  339. .Cf .debug_info .
  340. .IX \f(CW.debug_info\fP %debugai
  341. .P
  342. The intended audience for this document are the developers of 
  343. both producers and consumers of debugging information, typically
  344. language compilers, debuggers and other tools that need to interpret
  345. a binary program in terms of its original source.
  346. .H 2 "Overview"
  347. There are two major pieces to the description of the DWARF format in
  348. this document.  The first piece is the informational content
  349. of the debugging entries.  The second piece
  350. is the way the debugging information is encoded and 
  351. represented in an object file.
  352. .P
  353. The informational content is described in sections two
  354. through six.
  355. Section two describes the overall structure of
  356. the information and attributes that are common to many or all of
  357. the different debugging information entries.  
  358. Sections three, four and five describe the specific debugging
  359. information entries and how they communicate the
  360. necessary information about the source program to a debugger.
  361. Section six describes debugging information contained
  362. outside of the debugging information entries, themselves.
  363. The encoding of the DWARF information is
  364. presented in section seven.
  365. .P
  366. Section eight describes some future directions for the DWARF
  367. specification.
  368. .P
  369. In the following sections, text in normal font describes required aspects
  370. of the DWARF format.  Text in \fIitalics\fP is explanatory or supplementary 
  371. material, and not part of the format definition itself.
  372. .H 2 "Vendor Extensibility"
  373. .IX vendor extensions
  374. This document does not attempt to cover all interesting languages or even
  375. to cover all of the interesting debugging information needs for its primary
  376. target languages (C, C++, FORTRAN77, Fortran90, Modula2, Pascal). 
  377. Therefore the document provides
  378. vendors a way to define their own debugging information tags, attributes,
  379. base type encodings, location operations, language names,
  380. calling conventions and call frame instructions
  381. by reserving a portion of the name space and valid values 
  382. for these constructs for vendor specific additions.  Future versions
  383. of this document will not use names or values reserved for vendor specific
  384. additions.  All names and values not reserved for vendor additions, however,
  385. are reserved for future versions of this document.  See section 7 for
  386. details.
  387. .H 2 "Changes from Version 1"
  388. The following is a list of the major changes made to the DWARF Debugging
  389. Information Format since Version 1 of the format was published (January
  390. .IX Version 1
  391. 20, 1992).  The list is not meant to be exhaustive.
  392. .BL
  393. .LI
  394. Debugging information entries have been moved from the 
  395. .Cf .debug
  396. .IX \f(CW.debug\fP %debugaaa
  397. to the 
  398. .Cf .debug_info
  399. .IX \f(CW.debug_info\fP %debugai
  400. section of an object file.
  401. .LI
  402. .IX tags
  403. .IX attributes, names
  404. .IX attributes, forms
  405. The tag, attribute names and attribute forms encodings have been moved
  406. out of the debugging information itself to a separate abbreviations table.
  407. .IX abbreviations table
  408. .LI
  409. Explicit sibling pointers have been made optional.  Each
  410. .IX debugging information entries, siblings
  411. entry now specifies (through the abbreviations table) whether
  412. or not it has children.
  413. .IX debugging information entries, child entries
  414. .LI
  415. New more compact attribute forms have been added, including a variable
  416. length constant data form.  Attribute values may now have any 
  417. .IX variable length data
  418. .IX attributes, forms
  419. .IX attributes, values
  420. form within a given class of forms.
  421. .LI
  422. Location descriptions have been replaced by a new, more compact
  423. and more expressive format.
  424. .IX locations, descriptions
  425. There is now a way of expressing multiple locations for an object
  426. whose location changes during its lifetime.
  427. .IX locations, lists
  428. .LI
  429. There is a new format for line number information
  430. that provides information
  431. for code contributed to a compilation unit from an included file.
  432. Line number information is now in the 
  433. .IX line number information
  434. .Cf .debug_line
  435. .IX \f(CW.debug_line\fP %debugali
  436. section of an object file.
  437. .LI
  438. The representation of the type of a declaration has been
  439. reworked.
  440. .IX declarations, types of
  441. .LI
  442. A new section provides an encoding for pre-processor macro information.
  443. .IX macro information
  444. .IX pre-processor
  445. .LI
  446. Debugging information entries now provide for the representation
  447. of non-defining declarations of objects, functions or types.
  448. .IX declarations, non-defining
  449. .LI
  450. More complete support for Modula2 and Pascal has been added.
  451. .LI
  452. There is now a way of describing locations for segmented address spaces.
  453. .IX segmented address space
  454. .IX address space, segmented
  455. .LI
  456. A new section provides an encoding for information about call
  457. frame activations.
  458. .IX call frame information
  459. .IX activations
  460. .LI
  461. The representation of enumeration and array types has been
  462. .IX enumerations
  463. .IX arrays
  464. reworked so that DWARF presents only a single way of
  465. representing lists of items.
  466. .LI
  467. Support has been added for C++ templates and exceptions.
  468. .IX C++ %caa
  469. .IX templates
  470. .IX exceptions
  471. .LE
  472. .OP
  473. .H 1 "GENERAL DESCRIPTION"
  474. .H 2   "The Debugging Information Entry"
  475. DWARF uses a series of debugging information entries to define a
  476. .IX debugging information entries
  477. low-level representation of a source program. Each debugging
  478. information entry is described by an identifying tag and
  479. contains a series of attributes. 
  480. The tag specifies the class to which an entry
  481. belongs, and the attributes define the specific characteristics
  482. of the entry.
  483. .P
  484. .nr aX \n(Fg+1
  485. The set of required tag names is listed in Figure \n(aX.
  486. .IX tags
  487. The debugging information entries they identify are described in sections three, four and five.
  488. .P
  489. The debugging information entries in DWARF Version 2 are intended
  490. to exist in the 
  491. .Cf .debug_info
  492. section of an object file.
  493. .IX \f(CW.debug_info\fP %debugai
  494. .DF
  495. .TS
  496. center box;
  497. lf(CW) lf(CW)
  498. DW_TAG_access_declaration    DW_TAG_array_type
  499. DW_TAG_base_type    DW_TAG_catch_block
  500. DW_TAG_class_type    DW_TAG_common_block
  501. DW_TAG_common_inclusion    DW_TAG_compile_unit
  502. DW_TAG_const_type    DW_TAG_constant
  503. DW_TAG_entry_point    DW_TAG_enumeration_type
  504. DW_TAG_enumerator    DW_TAG_file_type
  505. DW_TAG_formal_parameter    DW_TAG_friend
  506. DW_TAG_imported_declaration    DW_TAG_inheritance
  507. DW_TAG_inlined_subroutine    DW_TAG_label
  508. DW_TAG_lexical_block    DW_TAG_member
  509. DW_TAG_module    DW_TAG_namelist
  510. DW_TAG_namelist_item    DW_TAG_packed_type
  511. DW_TAG_pointer_type    DW_TAG_ptr_to_member_type
  512. DW_TAG_reference_type    DW_TAG_set_type
  513. DW_TAG_string_type    DW_TAG_structure_type
  514. DW_TAG_subprogram    DW_TAG_subrange_type
  515. DW_TAG_subroutine_type    DW_TAG_template_type_param
  516. DW_TAG_template_value_param    DW_TAG_thrown_type
  517. DW_TAG_try_block    DW_TAG_typedef
  518. DW_TAG_union_type    DW_TAG_unspecified_parameters
  519. DW_TAG_variable    DW_TAG_variant
  520. DW_TAG_variant_part    DW_TAG_volatile_type
  521. DW_TAG_with_stmt
  522. .TE
  523. .FG "Tag names"
  524. .DE
  525. .H 2 "Attribute Types"
  526. Each attribute value is characterized by an attribute name.
  527. .IX attributes
  528. .IX attributes, names
  529. The set of attribute names is 
  530. .nr aX \n(Fg+1
  531. listed in Figure \n(aX.
  532. .DF
  533. .TS
  534. center box;
  535. lf(CW) lf(CW)
  536. DW_AT_abstract_origin    DW_AT_accessibility
  537. DW_AT_address_class    DW_AT_artificial
  538. DW_AT_base_types    DW_AT_bit_offset
  539. DW_AT_bit_size    DW_AT_byte_size
  540. DW_AT_calling_convention    DW_AT_common_reference
  541. DW_AT_comp_dir    DW_AT_const_value
  542. DW_AT_containing_type    DW_AT_count
  543. DW_AT_data_member_location    DW_AT_decl_column
  544. DW_AT_decl_file    DW_AT_decl_line
  545. DW_AT_declaration    DW_AT_default_value
  546. DW_AT_discr    DW_AT_discr_list
  547. DW_AT_discr_value    DW_AT_encoding
  548. DW_AT_external    DW_AT_frame_base
  549. DW_AT_friend    DW_AT_high_pc
  550. DW_AT_identifier_case    DW_AT_import
  551. DW_AT_inline    DW_AT_is_optional
  552. DW_AT_language    DW_AT_location
  553. DW_AT_low_pc    DW_AT_lower_bound
  554. DW_AT_macro_info    DW_AT_name
  555. DW_AT_namelist_item    DW_AT_ordering
  556. DW_AT_priority    DW_AT_producer
  557. DW_AT_prototyped    DW_AT_return_addr
  558. DW_AT_segment    DW_AT_sibling
  559. DW_AT_specification    DW_AT_start_scope
  560. DW_AT_static_link    DW_AT_stmt_list
  561. DW_AT_stride_size    DW_AT_string_length
  562. DW_AT_type    DW_AT_upper_bound
  563. DW_AT_use_location    DW_AT_variable_parameter
  564. DW_AT_virtuality    DW_AT_visibility
  565. DW_AT_vtable_elem_location
  566. .TE    
  567. .FG "Attribute names"
  568. .DE
  569. .P
  570. The permissible values for an attribute belong to one or more classes
  571. .IX attributes, values
  572. .IX attributes, forms
  573. of attribute value forms.  Each form class may be represented in one or more
  574. ways.  For instance, some attribute values consist of a single piece
  575. of constant data.  ``Constant data'' is the class of attribute value
  576. that those attributes may have.  There are several representations
  577. of constant data, however (one, two, four, eight bytes and variable
  578. length data).  The particular representation for any given instance
  579. of an attribute is encoded along with the attribute name as part
  580. of the information that guides the interpretation of a debugging
  581. information entry.   Attribute value forms may belong
  582. to one of the following classes.
  583. .VL 18
  584. .LI address
  585. .IX attributes, addresses
  586. Refers to some location in the address space of the described program.
  587. .LI block
  588. .IX attributes, blocks
  589. An arbitrary number of uninterpreted bytes of data.
  590. .LI constant
  591. .IX attributes, constants
  592. One, two, four or eight bytes of uninterpreted data, or data encoded
  593. in the variable length format known as LEB128 (see section 7.6).
  594. .IX variable length data
  595. .IX LEB128
  596. .LI flag
  597. .IX attributes, flags
  598. A small constant that indicates the presence or absence of an attribute.
  599. .LI reference
  600. .IX attributes, references
  601. Refers to some member of the set of debugging information entries that describe
  602. the program.  There are two types of reference.  The first is an
  603. offset relative to the beginning of the compilation unit in
  604. which the reference occurs and must refer to an entry within
  605. that same compilation unit.  The second type of reference
  606. is the address of any debugging information entry within
  607. the same executable or shared object; it may refer to an entry
  608. in a different compilation unit from the unit containing the
  609. reference.
  610. .LI string
  611. .IX attributes, strings
  612. A null-terminated sequence of zero or more (non-null) bytes.
  613. Data in this form are generally printable strings.  Strings
  614. may be represented directly in the debugging information entry
  615. or as an offset in a separate string table.
  616. .LE
  617. .P
  618. There are no limitations on the ordering of attributes within a debugging
  619. .IX attributes, ordering
  620. information entry, but to prevent ambiguity,
  621. no more than one attribute with a given name may appear in any debugging
  622. information entry.
  623. .H 2 "Relationship of Debugging Information Entries"
  624. .I
  625. A variety of needs can be met by permitting a single debugging
  626. information entry to ``own'' an arbitrary number of other debugging
  627. entries and by permitting the same debugging information entry to be
  628. one of many owned by another debugging information entry.
  629. This makes it possible to describe, for example,
  630. the static block structure within
  631. a source file, show the members of a structure, union, or class, and associate
  632. declarations with source files or source files with shared objects.
  633. .P
  634. .R
  635. The ownership relation
  636. of debugging information entries is achieved naturally
  637. .IX debugging information entries
  638. because the debugging information is represented as a tree.
  639. The nodes of the tree are the debugging information entries
  640. themselves.  The child entries of any node are exactly those
  641. .IX debugging information entries, child entries
  642. debugging information entries owned by that node.\*F
  643. .FS
  644. While the ownership relation of the debugging information
  645. entries is represented as a tree, other relations among
  646. the entries exist, for example, a pointer from an entry
  647. representing a variable to another entry representing
  648. the type of that variable.  If all such relations are
  649. taken into account, the debugging entries form a graph,
  650. not a tree.
  651. .FE
  652. .P
  653. The tree itself is represented by flattening it in prefix
  654. order.  Each debugging information entry
  655. is defined either to have child entries or not to have child entries
  656. (see section 7.5.3).
  657. If an entry is defined not to have children, the next physically
  658. succeeding entry is the sibling of the prior entry.  If an entry
  659. .IX debugging information entries, siblings
  660. is defined to have children, the next physically succeeding entry
  661. is the first child of the prior entry.  Additional children of the parent
  662. entry are represented as siblings of the first child.  A chain
  663. of sibling entries is terminated by a null entry.
  664. .IX debugging information entries, null entries
  665. .P
  666. In cases where a producer of debugging information
  667. feels that it will be important for consumers of that information
  668. to quickly scan chains of sibling entries, ignoring the children
  669. of individual siblings, that producer may attach an
  670. .Cf AT_sibling
  671. attribute to any debugging information entry.  The value of
  672. this attribute is a reference to the sibling entry of the
  673. entry to which the attribute is attached.
  674. .H 2 "Location Descriptions"
  675. .I
  676. The debugging information must provide consumers a way to find the location
  677. of program variables, determine the bounds of dynamic arrays and strings
  678. and possibly to find the base address of a subroutine's stack frame or
  679. the return address of a subroutine.  Furthermore, to meet the needs
  680. of recent computer architectures and optimization techniques, the debugging
  681. information must be able to describe the location of an object
  682. whose location changes over the object's lifetime.
  683. .P
  684. .R
  685. Information about the location of program objects is provided by
  686. location descriptions.  Location
  687. .IX locations, descriptions
  688. descriptions can be either of two forms: 
  689. .AL
  690. .LI
  691. \fILocation expressions\fP which are a language independent representation of 
  692. addressing rules
  693. .IX locations, expressions
  694. of arbitrary complexity built from a few basic
  695. building blocks, or \fIoperations\fP.  They are sufficient for describing
  696. the location of any object as long as its lifetime is either static
  697. or the same as the lexical block that owns it, and it does not move throughout 
  698. its lifetime.  
  699. .LI
  700. \fILocation lists\fP which are used to describe objects that 
  701. .IX locations, lists
  702. have a limited lifetime or change their location throughout their
  703. lifetime.  Location lists are more completely described below.
  704. .LE
  705. .P
  706. The two forms are distinguished in a context sensitive manner.  As the value
  707. of an attribute, a location expression is 
  708. encoded as a block and a location list is encoded as a constant offset into
  709. a location list table.
  710. .P
  711. .I
  712. Note: The Version 1 concept of "location descriptions" was replaced in Version 2 
  713. with this new abstraction because it is denser and more descriptive.  
  714. .IX Version 1
  715. .IX Version 2
  716. .R
  717. .H 3 "Location Expressions"
  718. A location expression consists of zero or more location operations.
  719. .IX locations, expressions
  720. An expression with zero operations 
  721. is used to denote an object that is
  722. present in the source code but not present in the object code
  723. (perhaps because of optimization).  
  724. .IX optimized code
  725. The location operations fall into two categories, register names and
  726. addressing operations.  Register names always appear alone and indicate
  727. that the referred object is contained inside a particular 
  728. register.  Addressing operations are memory address computation 
  729. rules.  All location operations are encoded as a stream of opcodes that
  730. are each followed by zero or more literal operands.  The number of operands
  731. is determined by the opcode.
  732. .H 3 "Register Name Operators"
  733. .IX locations, register name operators
  734. The following operations can be used to name a register.
  735. .P
  736. .I
  737. Note that the 
  738. register number represents a DWARF specific mapping of numbers onto
  739. the actual registers of a given architecture.
  740. The mapping should be chosen to gain optimal density and 
  741. should be shared by all users of a given architecture. 
  742. The \*(tE recommends
  743. that this mapping be defined by the ABI\*F
  744. .IX ABI
  745. .FS
  746. \fISystem V Application Binary Interface\fP, consisting of the generic
  747. interface and processor supplements for each target architecture.
  748. .FE
  749. authoring committee for each
  750. architecture.
  751. .R
  752. .AL
  753. .LI
  754. .Cf DW_OP_reg0 , " DW_OP_reg1" ", ..., " DW_OP_reg31
  755. .br
  756. The
  757. \f(CWDW_OP_reg\fP\fIn\fP
  758. operations encode the names of up to 32 registers, numbered from
  759. 0 through 31, inclusive.  The object addressed is in register \fIn\fP.
  760. .LI
  761. .Cf DW_OP_regx
  762. .br
  763. The
  764. .Cf DW_OP_regx
  765. operation has a single unsigned LEB128 literal operand that encodes the 
  766. name of a register.
  767. .LE
  768. .H 3 "Addressing Operations"
  769. .IX locations, stack
  770. Each addressing operation represents a postfix operation on a simple stack 
  771. machine.  Each element of the stack is the size of an
  772. address on the target machine.
  773. The value on the top of the stack after
  774. ``executing'' the location expression is taken to be the result (the address
  775. of the object, or the value of the array bound, or the length of a
  776. dynamic string).  In the case of locations used for structure members, 
  777. .IX members, locations
  778. the computation assumes that the base address of the containing structure
  779. has been pushed on the stack before evaluation of the addressing operation.
  780. .R
  781. .H 4 "Literal Encodings"
  782. .IX locations, literal encodings
  783. The following operations all push a value onto the addressing stack.
  784. .AL
  785. .LI
  786. .Cf DW_OP_lit0 , " DW_OP_lit1" ", ..., " DW_OP_lit31
  787. .br
  788. The
  789. \f(CWDW_OP_lit\fP\fIn\fP operations encode the unsigned 
  790. literal values from 0 through 31, inclusive.
  791. .LI
  792. .Cf DW_OP_addr
  793. .br
  794. The
  795. .Cf DW_OP_addr
  796. operation has a single operand that encodes a
  797. machine address and whose size is the size of an address on the
  798. target machine.
  799. .LI
  800. .Cf DW_OP_const1u
  801. .br
  802. The single operand of the
  803. .Cf DW_OP_const1u
  804. operation provides a 1-byte unsigned integer constant.
  805. .LI
  806. .Cf DW_OP_const1s
  807. .br
  808. The single operand of the
  809. .Cf DW_OP_const1s
  810. operation provides a
  811. 1-byte signed integer constant.
  812. .LI
  813. .Cf DW_OP_const2u
  814. .br
  815. The single operand of the
  816. .Cf DW_OP_const2u
  817. operation provides a
  818. 2-byte unsigned integer constant.
  819. .LI
  820. .Cf DW_OP_const2s
  821. .br
  822. The single operand of the
  823. .Cf DW_OP_const2s
  824. operation provides a
  825. 2-byte signed integer constant.
  826. .LI
  827. .Cf DW_OP_const4u
  828. .br
  829. The single operand of the
  830. .Cf DW_OP_const4u
  831. operation provides a
  832. 4-byte unsigned integer constant.
  833. .LI
  834. .Cf DW_OP_const4s
  835. .br
  836. The single operand of the
  837. .Cf DW_OP_const4s
  838. operation provides a
  839. 4-byte signed integer constant.
  840. .LI
  841. .Cf DW_OP_const8u
  842. .br
  843. The single operand of the
  844. .Cf DW_OP_const8u
  845. operation provides an
  846. 8-byte unsigned integer constant.
  847. .LI
  848. .Cf DW_OP_const8s
  849. .br
  850. The single operand of the
  851. .Cf DW_OP_const8s
  852. operation provides an
  853. 8-byte signed integer constant.
  854. .LI
  855. .Cf DW_OP_constu
  856. .br
  857. The single operand of the
  858. .Cf DW_OP_constu
  859. operation provides an
  860. unsigned LEB128 integer constant.
  861. .LI
  862. .Cf DW_OP_consts
  863. .br
  864. The single operand of the
  865. .Cf DW_OP_consts
  866. operation provides a
  867. signed LEB128 integer constant.
  868. .LE
  869. .H 4 "Register Based Addressing"
  870. .IX locations, register based addressing
  871. The following operations push a value onto the stack that 
  872. is the result of adding the contents of a register with 
  873. a given signed offset.  
  874. .AL
  875. .LI
  876. .Cf DW_OP_fbreg
  877. .br
  878. The
  879. \f(CWDW_OP_fbreg\fP
  880. operation provides a signed LEB128 offset from the address specified 
  881. by the location descriptor in the 
  882. .Cf DW_AT_frame_base 
  883. attribute of the current 
  884. .IX subroutines, frame base
  885. function.  \fI(This is typically a "stack pointer" register 
  886. plus or minus some
  887. offset.  On more sophisticated systems it might be a location list that
  888. adjusts the offset according to changes in the stack pointer as
  889. the PC changes.)\fP
  890. .LI
  891. .Cf DW_OP_breg0 , " DW_OP_breg1" ", ..., " DW_OP_breg31
  892. .br
  893. The single operand of the
  894. \f(CWDW_OP_breg\fP\fIn\fP
  895. operations provides a signed LEB128 offset from the specified register.
  896. .LI
  897. .Cf DW_OP_bregx
  898. .br
  899. The
  900. .Cf DW_OP_bregx
  901. operation has two operands:  a signed LEB128 offset from the specified register
  902. which is defined with an unsigned LEB128 number.
  903. .LE
  904. .H 4 "Stack Operations"
  905. .IX locations, stack
  906. The following operations 
  907. manipulate the ``location stack.''
  908. Location operations that index the location stack assume that
  909. the top of the stack (most recently added entry) has index 0.
  910. .AL
  911. .LI
  912. .Cf DW_OP_dup
  913. .br
  914. The
  915. .Cf DW_OP_dup 
  916. operation duplicates the value at the top of the location stack.
  917. .LI
  918. .Cf DW_OP_drop
  919. .br
  920. The
  921. .Cf DW_OP_drop 
  922. operation pops the value at the top of the stack.
  923. .LI
  924. .Cf DW_OP_pick
  925. .br
  926. The single operand of the
  927. .Cf DW_OP_pick
  928. operation provides a 1-byte index.  The stack entry with the specified index
  929. (0 through 255, inclusive) is pushed on the stack.
  930. .LI
  931. .Cf DW_OP_over
  932. .br
  933. The
  934. .Cf DW_OP_over
  935. operation duplicates the entry currently second in the stack
  936. at the top of the stack.  This is equivalent to an
  937. .Cf DW_OP_pick
  938. operation, with index 1.
  939. .LI
  940. .Cf DW_OP_swap
  941. .br
  942. The
  943. .Cf DW_OP_swap
  944. operation swaps the top two stack entries.   The entry at
  945. the top of the stack becomes the second stack entry, and
  946. the second entry becomes the top of the stack.
  947. .LI
  948. .Cf DW_OP_rot
  949. .br
  950. The
  951. .Cf DW_OP_rot
  952. operation rotates the first three stack entries.   The entry at
  953. the top of the stack becomes the third stack entry, the second entry
  954. becomes the top of the stack, and the third entry becomes the second
  955. entry.
  956. .LI
  957. .Cf DW_OP_deref
  958. .br
  959. The
  960. .Cf DW_OP_deref
  961. operation pops the top stack entry and treats it as an address.
  962. The value retrieved from that address is pushed.  The size of the
  963. data retrieved from the dereferenced address is the size of an address
  964. on the target machine.
  965. .LI
  966. .Cf DW_OP_deref_size
  967. .br
  968. The
  969. .Cf DW_OP_deref_size
  970. operation behaves like the 
  971. .Cf DW_OP_deref
  972. operation: it 
  973. pops the top stack entry and treats it as an address.
  974. The value retrieved from that address is pushed.  
  975. In the 
  976. .Cf DW_OP_deref_size
  977. operation, however,
  978. the size in bytes of the
  979. data retrieved from the dereferenced address is specified by the
  980. single operand.  This operand is a 1-byte unsigned integral constant
  981. whose value may not be larger than the size of an address on
  982. the target machine.  The data retrieved is zero extended to the size
  983. of an address on the target machine before being pushed on
  984. the expression stack.
  985. .LI
  986. .Cf DW_OP_xderef
  987. .br
  988. The
  989. .Cf DW_OP_xderef
  990. .IX address space, multiple
  991. operation provides an extended dereference mechanism.  The entry at the
  992. top of the stack is treated as an address.  The second stack entry
  993. is treated as an ``address space identifier'' for those architectures
  994. that support multiple address spaces.  The top two stack elements
  995. are popped, a data item is retrieved through an implementation-defined
  996. address calculation and pushed as the new stack top.  The size of the
  997. data retrieved from the dereferenced address is the size of an address
  998. on the target machine.
  999. .LI
  1000. .Cf DW_OP_xderef_size
  1001. .br
  1002. The
  1003. .Cf DW_OP_xderef_size
  1004. operation behaves like the 
  1005. .Cf DW_OP_xderef
  1006. operation: the entry at the
  1007. top of the stack is treated as an address.  The second stack entry
  1008. is treated as an ``address space identifier'' for those architectures
  1009. that support multiple address spaces.  The top two stack elements
  1010. are popped, a data item is retrieved through an implementation-defined
  1011. address calculation and pushed as the new stack top.  
  1012. In the 
  1013. .Cf DW_OP_xderef_size
  1014. operation, however,
  1015. the size in bytes of the
  1016. data retrieved from the dereferenced address is specified by the
  1017. single operand.  This operand is a 1-byte unsigned integral constant
  1018. whose value may not be larger than the size of an address on
  1019. the target machine.  The data retrieved is zero extended to the size
  1020. of an address on the target machine before being pushed on
  1021. the expression stack.
  1022. .LE
  1023. .H 4 "Arithmetic and Logical Operations"
  1024. .IX locations, arithmetic operations
  1025. .IX locations, logical operations
  1026. The following provide arithmetic and logical operations.
  1027. The arithmetic operations perform ``addressing arithmetic,''
  1028. that is, unsigned arithmetic that wraps on an address-sized 
  1029. boundary.  The operations do not cause an exception on overflow.
  1030. .AL
  1031. .LI
  1032. .Cf DW_OP_abs
  1033. .br
  1034. The
  1035. .Cf DW_OP_abs
  1036. operation pops the top stack entry and pushes its absolute value.
  1037. .LI
  1038. .Cf DW_OP_and
  1039. .br
  1040. The
  1041. .Cf DW_OP_and
  1042. operation pops the top two stack values, performs a bitwise \fIand\fP 
  1043. operation on the two, and pushes the result.
  1044. .LI
  1045. .Cf DW_OP_div
  1046. .br
  1047. The
  1048. .Cf DW_OP_div
  1049. operation pops the top two stack values, divides the former second entry
  1050. by the former top of the stack 
  1051. using signed division, 
  1052. and pushes the result.
  1053. .LI
  1054. .Cf DW_OP_minus
  1055. .br
  1056. The
  1057. .Cf DW_OP_minus
  1058. operation pops the top two stack values, subtracts the former top of the stack
  1059. from the former second entry, and pushes the result.
  1060. .LI
  1061. .Cf DW_OP_mod
  1062. .br
  1063. The
  1064. .Cf DW_OP_mod
  1065. operation pops the top two stack values and pushes the result of the 
  1066. calculation: former second stack entry modulo the former top of the
  1067. stack.
  1068. .LI
  1069. .Cf DW_OP_mul
  1070. .br
  1071. The
  1072. .Cf DW_OP_mul
  1073. operation pops the top two stack entries, multiplies them together,
  1074. and pushes the result.
  1075. .LI
  1076. .Cf DW_OP_neg
  1077. .br
  1078. The
  1079. .Cf DW_OP_neg
  1080. operation pops the top stack entry, and pushes its negation.
  1081. .LI
  1082. .Cf DW_OP_not
  1083. .br
  1084. The
  1085. .Cf DW_OP_not
  1086. operation pops the top stack entry, and pushes its bitwise complement.
  1087. .LI
  1088. .Cf DW_OP_or
  1089. .br
  1090. The
  1091. .Cf DW_OP_or
  1092. operation pops the top two stack entries, performs a bitwise \fIor\fP 
  1093. operation on the two, and pushes the result.
  1094. .LI
  1095. .Cf DW_OP_plus
  1096. .br
  1097. The
  1098. .Cf DW_OP_plus
  1099. operation pops the top two stack entries, adds them together,
  1100. and pushes the result.
  1101. .LI
  1102. .Cf DW_OP_plus_uconst
  1103. .br
  1104. The
  1105. .Cf DW_OP_plus_uconst
  1106. operation pops the top stack entry, adds it to the unsigned LEB128
  1107. constant operand and pushes the result.
  1108. .I
  1109. This operation is supplied specifically to be able to encode more field
  1110. offsets in two bytes than can be done with "\f(CWDW_OP_lit\fP\fIn\fP\f(CW DW_OP_add\fP".
  1111. .R
  1112. .LI
  1113. .Cf DW_OP_shl
  1114. .br
  1115. The
  1116. .Cf DW_OP_shl
  1117. operation pops the top two stack entries, shifts the former second
  1118. entry left by the number of bits specified by the former top of
  1119. the stack, and pushes the result.
  1120. .LI
  1121. .Cf DW_OP_shr
  1122. .br
  1123. The
  1124. .Cf DW_OP_shr
  1125. operation pops the top two stack entries, shifts the former second
  1126. entry right (logically) by the number of bits specified by the former top of
  1127. the stack, and pushes the result.
  1128. .LI
  1129. .Cf DW_OP_shra
  1130. .br
  1131. The
  1132. .Cf DW_OP_shra
  1133. operation pops the top two stack entries, shifts the former second
  1134. entry right (arithmetically) by the number of bits specified by the former top of
  1135. the stack, and pushes the result.
  1136. .LI
  1137. .Cf DW_OP_xor
  1138. .br
  1139. The
  1140. .Cf DW_OP_xor
  1141. operation pops the top two stack entries, performs the logical 
  1142. \fIexclusive-or\fP operation on the two, and pushes the result.
  1143. .LE
  1144. .H 4 "Control Flow Operations"
  1145. .IX locations, control flow operations
  1146. The following operations provide simple control of the flow of a location
  1147. expression.
  1148. .AL
  1149. .LI 
  1150. Relational operators
  1151. .br
  1152. The six relational operators each pops the top two stack values,
  1153. compares the former top of the stack with the former second entry,
  1154. and pushes the constant value 1 onto the stack if the result of the
  1155. operation is true or the constant value 0 if the result of the operation
  1156. is false.  The comparisons are done as signed operations.  The six
  1157. operators are 
  1158. .Cf DW_OP_le
  1159. (less than or equal to),
  1160. .Cf DW_OP_ge
  1161. (greater than or equal to),
  1162. .Cf DW_OP_eq
  1163. (equal to),
  1164. .Cf DW_OP_lt
  1165. (less than),
  1166. .Cf DW_OP_gt
  1167. (greater than) and
  1168. .Cf DW_OP_ne
  1169. (not equal to).
  1170. .LI
  1171. .Cf DW_OP_skip
  1172. .br
  1173. .Cf DW_OP_skip
  1174. is an unconditional branch.  Its
  1175. single operand is a 2-byte signed integer constant.
  1176. The 2-byte constant is the number of bytes of the location
  1177. expression to skip from the current operation, beginning after the
  1178. 2-byte constant.
  1179. .LI
  1180. .Cf DW_OP_bra
  1181. .br
  1182. .Cf DW_OP_bra
  1183. is a conditional branch.  Its
  1184. single operand is a 2-byte signed integer constant.
  1185. This operation pops the top of stack.  If the value
  1186. popped is not the constant 0, the 2-byte constant operand is the number
  1187. of bytes of the location 
  1188. expression to skip from the current operation, beginning after the
  1189. 2-byte constant.
  1190. .LE
  1191. .H 4 "Special Operations"
  1192. .IX locations, special operations
  1193. There are two special operations currently defined:
  1194. .AL
  1195. .LI
  1196. .Cf DW_OP_piece
  1197. .br
  1198. .I
  1199. Many compilers store a single variable in sets of registers, or store
  1200. a variable partially in memory and partially in registers.  
  1201. .Cf DW_OP_piece
  1202. provides a way of describing how large a part of a variable
  1203. a particular addressing expression refers to.
  1204. .R
  1205. .P
  1206. .Cf DW_OP_piece
  1207. takes a single argument which is an unsigned LEB128 number.  The number
  1208. describes the size in bytes of the piece of the object referenced
  1209. by the addressing expression whose result is at the top of
  1210. the stack.
  1211. .LI
  1212. .Cf DW_OP_nop
  1213. .br
  1214. The 
  1215. .Cf DW_OP_nop
  1216. operation is a place holder.  It has no effect on the location stack or
  1217. any of its values.
  1218. .LE
  1219. .H 3 "Sample Stack Operations"
  1220. .IX locations, examples
  1221. .I
  1222. The stack operations defined in section 2.4.3.3 are fairly
  1223. .IX locations, stack
  1224. conventional, but the following examples illustrate their behavior
  1225. graphically.
  1226. .R
  1227. .DS
  1228. .TS
  1229. box expand center tab(;);
  1230. l s l l s
  1231. lf(CW) lf(CW) lf(CW) lf(CW) lf(CW)
  1232. .
  1233. Before;Operation;After;
  1234. _
  1235. 0;17;DW_OP_dup;0;17
  1236. 1;29;;1;17
  1237. 2;1000;;2;29
  1238. ;;;3;1000
  1239. _
  1240. 0;17;DW_OP_drop;0;29
  1241. 1;29;;1;1000
  1242. 2;1000;;;;
  1243. _
  1244. 0;17;DW_OP_pick 2;0;1000
  1245. 1;29;;1;17
  1246. 2;1000;;2;29
  1247. ;;;3;1000
  1248. _
  1249. 0;17;DW_OP_over;0;29
  1250. 1;29;;1;17
  1251. 2;1000;;2;29
  1252. ;;;3;1000
  1253. _
  1254. 0;17;DW_OP_swap;0;29
  1255. 1;29;;1;17
  1256. 2;1000;;2;1000
  1257. _
  1258. 0;17;DW_OP_rot;0;29
  1259. 1;29;;1;1000
  1260. 2;1000;;2;17
  1261. .TE
  1262. .DE
  1263. .H 3 "Example Location Expressions"
  1264. .I
  1265. .IX locations, examples
  1266. The addressing expression represented by a location expression, 
  1267. if evaluated, generates the
  1268. runtime address of the value of a symbol except where the
  1269. .Cf DW_OP_reg n,
  1270. or
  1271. .Cf DW_OP_regx
  1272. operations are used.
  1273. .P
  1274. Here are some examples of how location operations are used to form location
  1275. expressions:
  1276. .R
  1277. .DS
  1278. \f(CWDW_OP_reg3\fI
  1279.     The value is in register 3.
  1280.  
  1281. \f(CWDW_OP_regx 54\fI
  1282.     The value is in register 54.
  1283.  
  1284. \f(CWDW_OP_addr 0x80d0045c\fI
  1285.     The value of a static variable is
  1286.     at machine address 0x80d0045c.
  1287.  
  1288. \f(CWDW_OP_breg11 44\fI
  1289.     Add 44 to the value in
  1290.     register 11 to get the address of an
  1291.     automatic variable instance.
  1292.  
  1293. \f(CWDW_OP_fbreg -50\fI
  1294.     Given an \f(CWDW_AT_frame_base\fI value of
  1295.     "\f(CWOPBREG31 64\fI," this example 
  1296.     computes the address of a local variable
  1297.     that is -50 bytes from a logical frame 
  1298.     pointer that is computed by adding
  1299.     64 to the current stack pointer (register 31).
  1300.  
  1301. \f(CWDW_OP_bregx 54 32 DW_OP_deref\fI
  1302.     A call-by-reference parameter
  1303.     whose address is in the
  1304.     word 32 bytes from where register
  1305.     54 points.  
  1306.  
  1307. \f(CWDW_OP_plus_uconst 4\fI
  1308.     A structure member is four bytes
  1309.     from the start of the structure
  1310.     instance.  The base address is
  1311.     assumed to be already on the stack.
  1312.  
  1313. \f(CWDW_OP_reg3 DW_OP_piece 4 DW_OP_reg10 DW_OP_piece 2\fI
  1314.     A variable whose first four bytes reside
  1315.     in register 3 and whose next two bytes
  1316.     reside in register 10.\fR
  1317. .DE
  1318. .H 3 "Location Lists"
  1319. .IX locations, lists
  1320. Location lists are used in place of location expressions whenever
  1321. the object whose location is being described can change location
  1322. during its lifetime.  Location lists are contained in a separate
  1323. object file section called
  1324. .Cf .debug_loc.
  1325. .IX \f(CW.debug_loc\fP %debugalo
  1326. A location list is indicated by a location
  1327. attribute whose value is represented as a
  1328. constant offset from the beginning of the 
  1329. .Cf .debug_loc
  1330. section to the first byte of the list for the object in question.
  1331. .P
  1332. Each entry in a location list consists of:
  1333. .AL
  1334. .LI
  1335. A beginning address.  This address is relative to the base address
  1336. of the compilation unit referencing this location list.  It marks
  1337. the beginning of the address range over which the location is valid.
  1338. .LI
  1339. An ending address, again relative to the base address
  1340. of the compilation unit referencing this location list.  It marks
  1341. the first address past the end of the address range over 
  1342. which the location is valid.
  1343. .LI
  1344. A location expression describing the location of the object over the
  1345. range specified by the beginning and end addresses.
  1346. .LE
  1347. .P
  1348. Address ranges may overlap.  When they do, they describe a situation
  1349. in which an object exists simultaneously in more than one place.
  1350. If all of the address ranges 
  1351. in a given location list do not collectively cover the entire
  1352. range over which the object in question is defined, it is assumed
  1353. that the object is not available for the portion of the range that is not
  1354. covered.
  1355. .IX optimized code
  1356. .P
  1357. The end of any given location list is marked by a 0 for the beginning
  1358. address and a 0 for the end address; no location description is present.
  1359. A location list containing
  1360. only such a 0 entry describes an object that exists in the source
  1361. code but not in the executable program. 
  1362. .H 2 "Types of Declarations"
  1363. .IX declarations, types of
  1364. Any debugging information entry describing a declaration that
  1365. has a type has a
  1366. .Cf DW_AT_type
  1367. attribute, whose value is a reference to another debugging
  1368. information entry.  The entry referenced may describe
  1369. .IX base types
  1370. .IX types, base
  1371. a base type, that is, a type that is not defined in terms
  1372. .IX user-defined types
  1373. .IX types, user-defined
  1374. of other data types, or it may describe a user-defined type,
  1375. such as an array, structure or enumeration.  Alternatively,
  1376. the entry referenced may describe a type modifier: constant,
  1377. packed, pointer, reference or volatile, which in turn will reference
  1378. another entry describing a type or type modifier (using a
  1379. .IX type modifiers
  1380. .IX types, modifiers
  1381. .IX types, packed
  1382. .IX types, constant
  1383. .IX types, pointer
  1384. .IX types, reference
  1385. .IX types, volatile
  1386. .Cf DW_AT_type
  1387. attribute of its own).  See section 5 for descriptions of
  1388. the entries describing base types, user-defined types and
  1389. type modifiers.
  1390. .H 2 "Accessibility of Declarations"
  1391. .I
  1392. .IX accessibility
  1393. .IX declarations, accessibility
  1394. Some languages, notably C++ and Ada, have the concept of
  1395. .IX C++ %caa
  1396. the accessibility of an object or of some other program entity.
  1397. The accessibility specifies which classes of other program objects
  1398. are permitted access to the object in question.
  1399. .R
  1400. .P
  1401. The accessibility of a declaration is represented by a
  1402. .Cf DW_AT_accessibility
  1403. attribute, whose value is a constant drawn from the set of codes
  1404. .nr aX \n(Fg+1
  1405. listed in Figure \n(aX.
  1406. .DF
  1407. .TS
  1408. box center;
  1409. lf(CW)
  1410. DW_ACCESS_public
  1411. DW_ACCESS_private
  1412. DW_ACCESS_protected
  1413. .TE
  1414. .FG "Accessibility codes"
  1415. .DE
  1416. .H 2 "Visibility of Declarations"
  1417. .I
  1418. .IX Modula2
  1419. .IX visibility
  1420. .IX declarations, visibility
  1421. Modula2 has the concept of the visibility of a declaration.
  1422. The visibility specifies which declarations are to be visible outside
  1423. of the module in which they are declared.
  1424. .R
  1425. .P
  1426. The visibility of a declaration is represented by a
  1427. .Cf DW_AT_visibility
  1428. attribute, whose value is a constant drawn from the set of codes
  1429. .nr aX \n(Fg+1
  1430. listed in Figure \n(aX.
  1431. .DF
  1432. .TS
  1433. box center;
  1434. lf(CW)
  1435. DW_VIS_local
  1436. DW_VIS_exported
  1437. DW_VIS_qualified
  1438. .TE
  1439. .FG "Visibility codes"
  1440. .DE
  1441. .H 2 "Virtuality of Declarations"
  1442. .I
  1443. .IX C++ %caa
  1444. .IX virtuality
  1445. .IX virtual functions
  1446. C++ provides for virtual and pure virtual structure or class
  1447. member functions and for virtual base classes.
  1448. .P
  1449. .R
  1450. The virtuality of a declaration is represented by a
  1451. .Cf DW_AT_virtuality
  1452. attribute, whose value is a constant drawn from the set of codes
  1453. .nr aX \n(Fg+1
  1454. listed in Figure \n(aX.
  1455. .DF
  1456. .TS
  1457. box center;
  1458. lf(CW)
  1459. DW_VIRTUALITY_none
  1460. DW_VIRTUALITY_virtual
  1461. DW_VIRTUALITY_pure_virtual
  1462. .TE
  1463. .FG "Virtuality codes"
  1464. .DE
  1465. .H 2 "Artificial Entries"
  1466. .I
  1467. .IX artificial entries
  1468. A compiler may wish to generate debugging information entries
  1469. for objects or types that were not actually declared
  1470. in the source of the application.  An example is a formal parameter
  1471. entry to represent the hidden 
  1472. .Cf this
  1473. parameter that most C++ implementations pass as the first argument
  1474. to non-static member functions.
  1475. .R
  1476. .P
  1477. Any debugging information entry representing the declaration of an
  1478. object or type artificially generated by a compiler and 
  1479. not explicitly declared by the source program may have a
  1480. .Cf DW_AT_artificial 
  1481. attribute.  The value of this attribute is a flag.
  1482. .H 2 "Target-Specific Addressing Information"
  1483. .I
  1484. .IX segmented address space
  1485. .IX address space, segmented
  1486. In some systems, addresses are specified as offsets within a given
  1487. segment rather than as locations within a single flat address space.
  1488. .R
  1489. .P
  1490. Any debugging information entry that contains a description of the
  1491. location of an object or subroutine may have a
  1492. .Cf DW_AT_segment
  1493. attribute, whose value is a location description.  The description
  1494. evaluates to the segment value of the item being described.  If
  1495. the entry containing the 
  1496. .Cf DW_AT_segment
  1497. attribute has a
  1498. .Cf DW_AT_low_pc
  1499. or 
  1500. .Cf DW_AT_high_pc
  1501. attribute, or a location description that evaluates to an address,
  1502. .IX locations, descriptions
  1503. .IX addresses, offset portion
  1504. then those values represent the offset portion of the address
  1505. within the segment specified by
  1506. .Cf DW_AT_segment .
  1507. .P
  1508. If an entry has no
  1509. .Cf DW_AT_segment
  1510. attribute, it inherits the segment value from its parent entry.
  1511. If none of the entries in the chain of parents for this entry
  1512. back to its containing compilation unit entry have 
  1513. .Cf DW_AT_segment
  1514. attributes, then the entry is assumed to exist within a flat
  1515. address space.  Similarly, if the entry has a
  1516. .IX flat address space
  1517. .IX address space, flat
  1518. .Cf DW_AT_segment
  1519. attribute containing an empty location description, that entry
  1520. is assumed to exist within a flat address space.
  1521. .P
  1522. .I
  1523. Some systems support different classes of addresses.  The address
  1524. class may affect the way a pointer is dereferenced or the way
  1525. a subroutine is called.
  1526. .P
  1527. .R
  1528. Any debugging information entry representing a pointer or reference
  1529. type or a subroutine or subroutine type may have a
  1530. .IX types, pointer
  1531. .IX types, reference
  1532. .IX subroutines
  1533. .IX subroutines, types
  1534. .Cf DW_AT_address_class
  1535. .IX addresses, class
  1536. attribute, whose value is a constant.  The set of permissible
  1537. values is specific to each target architecture.  The value
  1538. .Cf DW_ADDR_none ,
  1539. however, is common to all encodings, and means that no address class
  1540. has been specified.
  1541. .P
  1542. .I
  1543. For example, the Intel386\(tm processor might use the following
  1544. values:
  1545. .R
  1546. .DF
  1547. .TS
  1548. box center;
  1549. l l l
  1550. lf(CW) lf(CW) l
  1551. Name    Value    Meaning
  1552. _
  1553. DW_ADDR_none    0    no class specified
  1554. DW_ADDR_near16    1    16-bit offset, no segment
  1555. DW_ADDR_far16    2    16-bit offset, 16-bit segment
  1556. DW_ADDR_huge16    3    16-bit offset, 16-bit segment
  1557. DW_ADDR_near32    4    32-bit offset, no segment
  1558. DW_ADDR_far32    5    32-bit offset, 16-bit segment
  1559. .TE
  1560. .FG "Example address class codes"
  1561. .DE
  1562. .H 2 "Non-Defining Declarations"
  1563. .IX declarations, non-defining
  1564. .IX declarations, defining
  1565. A debugging information entry representing a program object or type
  1566. typically represents the defining declaration of that object or type.  In
  1567. certain contexts, however, a debugger might need information about a
  1568. declaration of a subroutine, object or type that is not also a 
  1569. definition to evaluate an expression correctly. 
  1570. .P
  1571. .I
  1572. As an example, consider the following fragment of C code:
  1573. .DS
  1574. \f(CWvoid myfunc()
  1575. {
  1576.         int     x;
  1577.         {
  1578.                 extern float x;
  1579.                 g(x);
  1580.         }
  1581. }\fP
  1582. .DE
  1583. .P
  1584. ANSI-C scoping rules require that the value of the variable \f(CWx\fP
  1585. passed to the function \f(CWg\fP is the value of the global variable
  1586. \f(CWx\fP rather than of the local version.
  1587. .R
  1588. .P
  1589. Debugging information entries that represent non-defining declarations
  1590. of a program object or type have a
  1591. .Cf DW_AT_declaration
  1592. attribute, whose value is a flag.
  1593. .H 2 "Declaration Coordinates"
  1594. .I
  1595. It is sometimes useful in a debugger to be able to associate a declaration
  1596. with its occurrence in the program source.  
  1597. .P
  1598. .R
  1599. .IX declarations, coordinates
  1600. Any debugging information entry representing the declaration of 
  1601. an object, module, subprogram or type may have 
  1602. .Cf DW_AT_decl_file ,
  1603. .Cf DW_AT_decl_line 
  1604. and
  1605. .Cf DW_AT_decl_column
  1606. attributes, each of whose value is a constant.
  1607. .P
  1608. The value of the 
  1609. .Cf DW_AT_decl_file 
  1610. attribute corresponds
  1611. to a file number from the statement information table for the compilation
  1612. .IX line number information
  1613. unit containing this debugging information entry and represents the
  1614. source file in which the declaration appeared (see section 6.2).
  1615. .IX source, files
  1616. The value 0 indicates that no source file has been specified.
  1617. .P
  1618. The value of the
  1619. .Cf DW_AT_decl_line
  1620. attribute represents the source line number at which the first
  1621. .IX source, lines
  1622. character of the identifier of the declared object appears.
  1623. The value 0 indicates that no source line has been specified.
  1624. .P
  1625. The value of the
  1626. .Cf DW_AT_decl_column
  1627. attribute represents the source column number at which the first
  1628. .IX source, columns
  1629. character of the identifier of the declared object appears.
  1630. The value 0 indicates that no column has been specified.
  1631. .H 2 "Identifier Names"
  1632. .IX identifiers, names
  1633. Any debugging information entry representing a program entity that
  1634. has been given a name may have a
  1635. .Cf DW_AT_name
  1636. attribute, whose value is a string representing the name as it appears
  1637. in the source program.  A debugging information entry containing
  1638. no name attribute, or containing a name attribute whose value consists
  1639. of a name containing a single null byte,
  1640. represents a program entity for which no name was given in the source.
  1641. .I
  1642. .P
  1643. Note that since the names of program objects
  1644. described by DWARF are the names as they appear in the source program,
  1645. implementations of language translators that use some form of mangled
  1646. name (as do many implementations of C++) should use the unmangled
  1647. .IX C++ %caa
  1648. form of the name in the DWARF 
  1649. .Cf DW_AT_name
  1650. attribute, including the keyword
  1651. .Cf operator ,
  1652. if present.  Sequences of multiple whitespace characters may be compressed.
  1653. .R
  1654. .OP
  1655. .H 1 "PROGRAM SCOPE ENTRIES"
  1656. This section describes debugging information entries that relate
  1657. to different levels of program scope: compilation unit, module,
  1658. subprogram, and so on.  These entries may be thought of as
  1659. bounded by ranges of text addresses within the program.
  1660. .H 2   "Compilation Unit Entries"
  1661. An object file may be derived from one or more compilation units.  Each
  1662. such compilation unit will be described by a debugging information 
  1663. entry with the tag \f(CWDW_TAG_compile_unit\fP.
  1664. .I
  1665. .P
  1666. A compilation unit typically represents the text and data contributed
  1667. .IX compilation units
  1668. to an executable by a single relocatable object file.  It may
  1669. be derived from several source files, including pre-processed ``include
  1670. files.''
  1671. .R
  1672. .P
  1673. The compilation unit entry may have the following attributes:
  1674. .AL
  1675. .LI
  1676. .Cf DW_AT_low_pc
  1677. attribute whose value is the
  1678. relocated address of the first machine instruction generated for that 
  1679. compilation unit.
  1680. .LI
  1681. A
  1682. .Cf DW_AT_high_pc
  1683. attribute whose value is the
  1684. relocated address of the first location
  1685. past the last machine instruction generated for that compilation unit.
  1686. .P
  1687. .I
  1688. The address may be beyond the last valid instruction in the executable,
  1689. of course, for this and other similar attributes.
  1690. .R
  1691. .P
  1692. The presence of low and high pc attributes in a compilation unit entry
  1693. imply that the code generated for that compilation unit is
  1694. contiguous and exists totally within the boundaries specified
  1695. by those two attributes.  If that is not the case, no low
  1696. and high pc attributes should be produced.
  1697. .IX address space, contiguous
  1698. .LI
  1699. A
  1700. .Cf DW_AT_name
  1701. attribute whose value is a
  1702. null-terminated string containing the full or relative path name of
  1703. the primary source file from which the compilation unit was derived.
  1704. .IX source, files
  1705. .LI
  1706. .Cf DW_AT_language
  1707. attribute whose constant value is
  1708. .IX languages
  1709. a code indicating the source language of the compilation unit.
  1710. .nr aX \n(Fg+1
  1711. The set of language names and their meanings are 
  1712. given in Figure \n(aX.
  1713. .DF
  1714. .TS
  1715. box center;
  1716. lf(CW) lf(R)
  1717. DW_LANG_C    Non-ANSI C, such as K&R
  1718. DW_LANG_C89    ISO/ANSI C
  1719. DW_LANG_C_plus_plus    C++
  1720. DW_LANG_Fortran77    FORTRAN77
  1721. DW_LANG_Fortran90    Fortran90
  1722. DW_LANG_Modula2    Modula2
  1723. DW_LANG_Pascal83    ISO/ANSI Pascal
  1724. .TE
  1725. .FG "Language names"
  1726. .DE
  1727. .LI
  1728. A
  1729. .Cf DW_AT_stmt_list
  1730. attribute whose value is a reference to
  1731. line number information for this compilation unit.
  1732. .IX line number information
  1733. .P
  1734. This information is placed in a separate object file section from the debugging
  1735. information entries themselves.  The value of the statement list attribute
  1736. is the offset in the \f(CW.debug_line\fP section of the first byte of the 
  1737. line number information for this compilation unit.  See section 6.2.
  1738. .LI
  1739. A
  1740. .Cf DW_AT_macro_info
  1741. attribute whose value is a reference to the macro information for this
  1742. compilation unit.
  1743. .IX macro information
  1744. .P
  1745. This information is placed in a separate object file section from the debugging
  1746. information entries themselves.  The value of the macro information attribute
  1747. is the offset in the \f(CW.debug_macinfo\fP section of the first byte of the 
  1748. macro information for this compilation unit.  See section 6.3.
  1749. .LI
  1750. A
  1751. .Cf DW_AT_comp_dir
  1752. attribute whose value is a null-terminated string containing
  1753. the current working directory of the compilation command that
  1754. produced this compilation unit in whatever form makes sense
  1755. for the host system.
  1756. .P
  1757. .I
  1758. The suggested form for the value of the \f(CWDW_AT_comp_dir\fP
  1759. attribute on \*(aX systems is ``hostname\f(CW:\fPpathname''.  If no
  1760. hostname is available, the suggested form is ``\f(CW:\fPpathname''.
  1761. .R
  1762. .LI
  1763. A
  1764. .Cf DW_AT_producer
  1765. attribute whose value is a null-terminated string containing information
  1766. about the compiler that produced the compilation unit.  The
  1767. actual contents of the string will be specific to each producer,
  1768. but should begin with the name of the compiler vendor or some
  1769. other identifying character sequence that should avoid
  1770. confusion with other producer values.
  1771. .LI
  1772. A
  1773. .Cf DW_AT_identifier_case
  1774. .IX identifiers, case
  1775. attribute whose constant value is a code describing the treatment of
  1776. identifiers within this compilation unit.  The set of identifier case
  1777. .nr aX \n(Fg+1
  1778. codes is given in Figure \n(aX.
  1779. .DF
  1780. .TS
  1781. box center;
  1782. lf(CW)
  1783. DW_ID_case_sensitive
  1784. DW_ID_up_case
  1785. DW_ID_down_case
  1786. DW_ID_case_insensitive
  1787. .TE
  1788. .FG "Identifier case codes"
  1789. .DE
  1790. .P
  1791. .Cf DW_ID_case_sensitive 
  1792. is the default for all compilation units that do not have this attribute.
  1793. It indicates that names given as the values of 
  1794. .Cf DW_AT_name
  1795. attributes in debugging information entries for the compilation unit
  1796. reflect the names as they appear in the source program.
  1797. The debugger should be sensitive to the case of identifier names
  1798. when doing identifier lookups.
  1799. .P
  1800. .Cf DW_ID_up_case
  1801. means that the producer of the debugging information for this compilation
  1802. unit converted all source names to upper case.  The values of the
  1803. name attributes may not reflect the names as they appear in the source
  1804. program.  The debugger should convert all names to upper case
  1805. when doing lookups.
  1806. .P
  1807. .Cf DW_ID_down_case
  1808. means that the producer of the debugging information for this compilation
  1809. unit converted all source names to lower case.  The values of the
  1810. name attributes may not reflect the names as they appear in the source
  1811. program.  The debugger should convert all names to lower case when
  1812. doing lookups.
  1813. .P
  1814. .Cf DW_ID_case_insensitive 
  1815. means that the values of the name attributes reflect the names
  1816. as they appear in the source program but that a case insensitive
  1817. lookup should be used to access those names.
  1818. .LI
  1819. A
  1820. .Cf DW_AT_base_types
  1821. .IX base types
  1822. .IX types, base
  1823. attribute whose value is a reference.  This attribute points to
  1824. a debugging information entry representing another compilation
  1825. unit.  It may be used to specify the compilation unit containing
  1826. the base type entries used by entries in the current compilation
  1827. unit (see section 5.1).
  1828. .P
  1829. .I
  1830. This attribute provides a consumer a way to find the definition
  1831. of base types for a compilation unit that does not itself
  1832. contain such definitions.  This allows a consumer, for example,
  1833. to interpret a type conversion to a base type correctly.
  1834. .R
  1835. .LE
  1836. .R
  1837. .P
  1838. A compilation unit entry 
  1839. owns debugging information entries that represent the declarations made in
  1840. the corresponding compilation unit.
  1841. .H 2 "Module Entries"
  1842. .I
  1843. Several languages have the concept of a ``module.''  
  1844. .IX modules
  1845. .P
  1846. .R
  1847. A module is
  1848. represented by a debugging information entry with the tag
  1849. .Cf DW_TAG_module .
  1850. Module entries may own other debugging information entries describing
  1851. program entities whose declaration scopes end at the end of the module
  1852. itself.
  1853. .P
  1854. If the module has a name, the module entry has a 
  1855. .Cf DW_AT_name 
  1856. attribute whose
  1857. value is a null-terminated string containing the module name as it appears
  1858. in the source program.
  1859. .P
  1860. If the module contains initialization code, the module entry
  1861. has a 
  1862. .Cf DW_AT_low_pc
  1863. attribute whose value is the
  1864. relocated address of the first machine instruction generated for that 
  1865. initialization code.  It also has a 
  1866. .Cf DW_AT_high_pc
  1867. attribute whose value is
  1868. the relocated address of the first location past the last machine
  1869. instruction generated for the initialization code.
  1870. .P
  1871. If the module has been assigned a priority, it may have a
  1872. .Cf DW_AT_priority
  1873. attribute.  The value of this attribute is a reference to another
  1874. .IX modules, priority
  1875. debugging information entry describing a variable with a constant
  1876. value.  The value of this variable is the actual constant
  1877. value of the module's priority, represented as it would be on the
  1878. target architecture.
  1879. .P
  1880. .I
  1881. .IX Modula2
  1882. .IX modules, definition
  1883. A Modula2 definition module may be represented by a module entry
  1884. containing a
  1885. .Cf DW_AT_declaration
  1886. attribute.
  1887. .R
  1888. .H 2   "Subroutine and Entry Point Entries"
  1889. .IX subroutines
  1890. .IX entry points
  1891. The following tags exist to describe debugging information
  1892. entries for subroutines and entry points:
  1893. .VL 30
  1894. .LI \f(CWDW_TAG_subprogram\fP
  1895. A global or file static subroutine or function.
  1896. .LI \f(CWDW_TAG_inlined_subroutine\fP
  1897. A particular inlined instance of a subroutine or function.
  1898. .LI \f(CWDW_TAG_entry_point\fP
  1899. A Fortran entry point.
  1900. .LE
  1901. .H 3 "General Subroutine and Entry Point Information"
  1902. The subroutine or entry point entry has a 
  1903. .Cf DW_AT_name 
  1904. attribute
  1905. whose value is a null-terminated string containing the subroutine or entry
  1906. point name as it appears in the source program.
  1907. .P
  1908. If the name of the subroutine described by an entry with the tag
  1909. .Cf DW_TAG_subprogram
  1910. is visible outside of its containing compilation unit, that
  1911. entry has a
  1912. .Cf DW_AT_external
  1913. attribute, whose value is a flag.
  1914. .IX declarations, external
  1915. .I
  1916. .P
  1917. .IX members, functions
  1918. .IX subroutines, members
  1919. Additional attributes for functions that are members of a class or
  1920. structure are described in section 5.5.5.
  1921. .P
  1922. A common debugger feature is to allow the debugger user to call a
  1923. subroutine within the subject program.  In certain cases, however,
  1924. the generated code for a subroutine will not obey the standard calling
  1925. conventions for the target architecture and will therefore not
  1926. .IX calling conventions
  1927. be safe to call from within a debugger.
  1928. .R
  1929. .P
  1930. A subroutine entry may contain a
  1931. .Cf DW_AT_calling_convention
  1932. attribute, whose value is a constant.  If this attribute is not
  1933. present, or its value is the constant
  1934. .Cf DW_CC_normal ,
  1935. then the subroutine may be safely called by obeying the ``standard''
  1936. calling conventions of the target architecture.  If the value of
  1937. the calling convention attribute is the constant
  1938. .Cf DW_CC_nocall ,
  1939. the subroutine does not obey standard calling conventions, and it
  1940. may not be safe for the debugger to call this subroutine.
  1941. .P
  1942. If the semantics of the language of the compilation unit 
  1943. containing the subroutine entry distinguishes between ordinary subroutines
  1944. .IX main programs
  1945. and subroutines that can serve as the ``main program,'' that is, subroutines
  1946. that cannot be called directly following the ordinary calling conventions,
  1947. then the debugging information entry for such a subroutine may have a
  1948. calling convention attribute whose value is the constant
  1949. .Cf DW_CC_program .
  1950. .P
  1951. .I
  1952. The 
  1953. .Cf DW_CC_program 
  1954. value is intended to support Fortran main programs.
  1955. It is not intended as a way of finding the entry address for the program.
  1956. .R
  1957. .H 3 "Subroutine and Entry Point Return Types"
  1958. .IX subroutines, return types
  1959. .IX entry points, return types
  1960. If the subroutine or entry point is a function that returns a value, then
  1961. its debugging information entry has a
  1962. .Cf DW_AT_type
  1963. attribute to denote the type returned by that function.
  1964. .P
  1965. .I
  1966. Debugging information entries for C 
  1967. .Cf void
  1968. .IX C %c
  1969. functions should not have an attribute for the return type.
  1970. .P
  1971. In ANSI-C there is a difference between the types of functions
  1972. declared using function prototype style declarations and those
  1973. declared using non-prototype declarations.  
  1974. .IX subroutines, prototypes
  1975. .P
  1976. .R
  1977. A subroutine entry
  1978. declared with a function prototype style declaration may have a
  1979. .Cf DW_AT_prototyped
  1980. attribute, whose value is a flag.
  1981. .H 3 "Subroutine and Entry Point Locations"
  1982. .IX subroutines, locations
  1983. .IX entry points, locations
  1984. A subroutine entry has a
  1985. .Cf DW_AT_low_pc
  1986. attribute whose value is the relocated address of the first machine instruction
  1987. generated for the subroutine.
  1988. It also has a
  1989. .Cf DW_AT_high_pc
  1990. attribute whose value is the relocated address of the
  1991. first location past the last machine instruction generated
  1992. for the subroutine.  
  1993. .P
  1994. .I
  1995. Note that for the low and high pc attributes to have meaning, DWARF
  1996. makes the assumption that the code for a single subroutine is allocated
  1997. in a single contiguous block of memory.
  1998. .IX address space, contiguous
  1999. .R
  2000. .P
  2001. An entry point has a
  2002. .Cf DW_AT_low_pc
  2003. attribute whose value is the relocated address of the first machine instruction
  2004. generated for the entry point.
  2005. .P
  2006. Subroutines and entry points may also have 
  2007. .Cf DW_AT_segment 
  2008. and 
  2009. .Cf DW_AT_address_class
  2010. .IX segmented address space
  2011. .IX address space, segmented
  2012. .IX addresses, class
  2013. attributes, as appropriate, to specify which segments the code
  2014. for the subroutine resides in and the addressing mode to be used
  2015. in calling that subroutine.
  2016. .P
  2017. A subroutine entry representing a subroutine declaration
  2018. that is not also a definition does not have low and high pc attributes.
  2019. .IX declarations, non-defining
  2020. .H 3 "Declarations Owned by Subroutines and Entry Points"
  2021. .IX subroutines, declarations owned by
  2022. .IX entry points, declarations owned by
  2023. The declarations enclosed by a subroutine or entry point
  2024. are represented by debugging information entries that are
  2025. owned by the subroutine or entry point entry.
  2026. Entries representing the formal parameters of the subroutine or
  2027. entry point appear in
  2028. the same order as the corresponding declarations in the source program.
  2029. .IX attributes, ordering
  2030. .IX parameters, formal
  2031. .P
  2032. .I
  2033. There is no ordering requirement on entries for declarations that are
  2034. children of subroutine or entry point entries but that do not represent
  2035. formal parameters.  The formal parameter entries may be interspersed
  2036. with other entries used by formal parameter entries, such as type entries.
  2037. .R
  2038. .P
  2039. The unspecified parameters of a variable parameter list
  2040. .IX parameters, unspecified
  2041. are represented by a debugging information entry with the tag 
  2042. .Cf DW_TAG_unspecified_parameters .
  2043. .P
  2044. The entry for a subroutine or entry point that includes a Fortran 
  2045. .IX Fortran
  2046. .IX common blocks
  2047. common block has a child entry with the tag
  2048. .Cf DW_TAG_common_inclusion .
  2049. The common inclusion entry has a
  2050. .Cf DW_AT_common_reference
  2051. attribute whose value is a reference to the debugging entry for
  2052. the common block being included (see section 4.2).
  2053. .H 3 "Low-Level Information"
  2054. A subroutine or entry point entry may have a
  2055. .Cf DW_AT_return_addr
  2056. .IX subroutines, return addresses
  2057. attribute, whose value is a location description.
  2058. The location calculated is the place where the return address for 
  2059. the subroutine or entry point is stored.
  2060. .P
  2061. A subroutine or entry point entry may also have a
  2062. .Cf DW_AT_frame_base
  2063. .IX subroutines, frame base
  2064. attribute, whose value is a location description that
  2065. computes the ``frame base'' for the subroutine or entry point.
  2066. .P
  2067. .I
  2068. The frame base for a procedure is typically an address fixed
  2069. relative to the first unit of storage allocated for the procedure's
  2070. stack frame.  The 
  2071. .Cf DW_AT_frame_base
  2072. attribute can be used in several ways:
  2073. .AL
  2074. .LI
  2075. In procedures that need location lists to locate local variables, the
  2076. .Cf DW_AT_frame_base
  2077. can hold the needed location list, while all variables'
  2078. location descriptions can be simpler location expressions involving the frame 
  2079. base.
  2080. .LI
  2081. It can be used as a key in resolving "up-level" addressing with nested
  2082. routines.  (See 
  2083. .Cf DW_AT_static_link ,
  2084. below)
  2085. .LE
  2086. .P
  2087. Some languages support nested subroutines.  In such languages, it is possible
  2088. .IX subroutines, nested
  2089. to reference the local variables of an outer subroutine from within
  2090. an inner subroutine.  The 
  2091. .Cf DW_AT_static_link 
  2092. and 
  2093. .Cf DW_AT_frame_base 
  2094. attributes allow debuggers to support this same kind of referencing.
  2095. .R
  2096. .P
  2097. If a subroutine or entry point is nested, it may have a
  2098. .Cf DW_AT_static_link
  2099. attribute, whose value is a location description that
  2100. computes the frame base of the relevant instance of the subroutine
  2101. that immediately encloses the subroutine or entry point.
  2102. .P
  2103. In the context of supporting nested subroutines, the 
  2104. .Cf DW_AT_frame_base
  2105. attribute value should obey the following constraints:
  2106. .AL
  2107. .LI
  2108. It should compute a value that does not change during the life of the procedure,
  2109. and
  2110. .LI
  2111. The computed value should be unique among instances of the same subroutine.
  2112. (For typical 
  2113. .Cf DW_AT_frame_base 
  2114. use, this means that a recursive
  2115. subroutine's stack frame must have non-zero size.)
  2116. .LE
  2117. .P
  2118. .I
  2119. If a debugger is attempting to resolve an up-level reference to a variable, it
  2120. uses the nesting structure of DWARF to determine which subroutine is the lexical
  2121. parent and the 
  2122. .Cf DW_AT_static_link
  2123. value to identify the appropriate active frame
  2124. of the parent.  It can then attempt to find the reference within the context
  2125. of the parent. 
  2126. .R
  2127. .H 3 "Types Thrown by Exceptions"
  2128. .I
  2129. In C++ a subroutine may declare a set of types for which
  2130. .IX C++ %caa
  2131. .IX exceptions
  2132. that subroutine may generate or ``throw'' an exception.
  2133. .P
  2134. .R
  2135. If a subroutine explicitly declares that it may throw an
  2136. exception for one or more types, each such type is
  2137. represented by a debugging information entry with the tag
  2138. .Cf DW_TAG_thrown_type .
  2139. Each such entry is a child of the entry representing the
  2140. subroutine that may throw this type.  All thrown type entries
  2141. should follow all entries representing the formal parameters
  2142. of the subroutine and precede all entries representing the
  2143. local variables or lexical blocks contained in the subroutine.
  2144. Each thrown type entry contains a
  2145. .Cf DW_AT_type
  2146. attribute, whose value is a reference to an entry describing
  2147. the type of the exception that may be thrown.
  2148. .H 3 "Function Template Instantiations"
  2149. .I
  2150. .IX C++ %caa
  2151. .IX templates
  2152. In C++ a function template is a generic
  2153. definition of a function that
  2154. is instantiated differently when called with values
  2155. of different types.  DWARF does not represent the generic
  2156. template definition, but does represent each instantiation.
  2157. .R
  2158. .P
  2159. A template instantiation is represented by a debugging information
  2160. entry with the tag
  2161. .Cf DW_TAG_subprogram .
  2162. With three exceptions,
  2163. such an entry will contain the same attributes and have the same
  2164. types of child entries as would an entry for a subroutine 
  2165. defined explicitly
  2166. using the instantiation types.  The exceptions are:
  2167. .AL
  2168. .LI 
  2169. Each formal parameterized type declaration appearing in the
  2170. template definition is represented by a debugging information entry
  2171. with the tag 
  2172. .Cf DW_TAG_template_type_parameter .
  2173. Each such entry has a 
  2174. .Cf DW_AT_name
  2175. attribute, whose value is a null-terminated
  2176. string containing the name of the formal type parameter as it
  2177. appears in the source program.  The template type parameter
  2178. entry also has a 
  2179. .Cf DW_AT_type
  2180. attribute describing the actual type by
  2181. which the formal is replaced for this instantiation.
  2182. All template type parameter entries should appear before
  2183. the entries describing the instantiated formal parameters
  2184. to the function.
  2185. .LI
  2186. .IX compilation units
  2187. If the compiler has generated a special compilation unit
  2188. to hold the template instantiation and that compilation unit
  2189. has a different name
  2190. from the compilation unit containing the template definition,
  2191. the name attribute for the debugging entry representing
  2192. that compilation unit should be empty or omitted.
  2193. .LI
  2194. .IX declarations, coordinates
  2195. If the subprogram entry representing the template instantiation
  2196. or any of its child entries
  2197. contain declaration coordinate attributes, those attributes
  2198. should refer to the source for the template definition, not
  2199. to any source generated artificially by the compiler for this
  2200. instantiation.
  2201. .LE
  2202. .H 3 "Inline Subroutines"
  2203. .IX subroutines, inline
  2204. A declaration or a definition of an inlinable subroutine
  2205. is represented by a debugging information entry with the tag
  2206. .Cf DW_TAG_subprogram .
  2207. The entry for a subroutine that is explicitly declared
  2208. to be available for inline expansion or that was expanded inline
  2209. implicitly by the compiler has a
  2210. .Cf DW_AT_inline 
  2211. attribute whose value is a constant.  The set of values 
  2212. for the 
  2213. .Cf DW_AT_inline
  2214. .nr aX \n(Fg+1
  2215. attribute is given in Figure \n(aX.
  2216. .DF
  2217. .TS
  2218. box center;
  2219. l l
  2220. lf(CW) l
  2221. Name    Meaning
  2222. _
  2223. DW_INL_not_inlined    Not declared inline nor inlined by the compiler
  2224. DW_INL_inlined    Not declared inline but inlined by the compiler
  2225. DW_INL_declared_not_inlined    Declared inline but not inlined by the compiler
  2226. DW_INL_declared_inlined    Declared inline and inlined by the compiler
  2227. .TE
  2228. .FG "Inline codes"
  2229. .DE
  2230. .H 4 "Abstract Instances"
  2231. For the remainder of this discussion,
  2232. any debugging information entry that is owned (either directly or
  2233. indirectly) by a debugging information entry that contains the 
  2234. .Cf DW_AT_inline
  2235. attribute will be referred to as an ``abstract instance entry.''
  2236. Any subroutine entry that contains a
  2237. .Cf DW_AT_inline 
  2238. attribute will be known as an ``abstract instance root.''
  2239. Any set of abstract instance entries that are all children (either directly
  2240. or indirectly) of some abstract instance root, together with the root itself,
  2241. will be known as an ``abstract instance tree.''
  2242. .P
  2243. A debugging information entry that is a member of an abstract instance
  2244. tree should not contain a
  2245. .Cf DW_AT_high_pc , 
  2246. .Cf DW_AT_low_pc , 
  2247. .Cf DW_AT_location ,
  2248. .Cf DW_AT_return_addr , 
  2249. .Cf DW_AT_start_scope ,
  2250. or
  2251. .Cf DW_AT_segment 
  2252. attribute.
  2253. .P
  2254. .I
  2255. It would not make sense to put these attributes
  2256. into abstract instance entries since
  2257. such entries do not represent actual (concrete) instances and thus
  2258. do not actually exist at run-time.
  2259. .P
  2260. .R
  2261. The rules for the relative location of entries belonging to abstract instance 
  2262. trees are exactly
  2263. the same as for other similar types of entries that are not abstract.
  2264. Specifically, the rule that requires that an entry representing a
  2265. declaration be a direct child of the entry representing the scope of
  2266. the declaration applies equally to both abstract and
  2267. non-abstract entries.  Also, the ordering rules for formal parameter entries,
  2268. member entries, and so on, all apply regardless of whether or not a given entry
  2269. is abstract.
  2270. .H 4 "Concrete Inlined Instances"
  2271. .IX subroutines, inlined
  2272. Each inline expansion of an inlinable subroutine is represented
  2273. by a debugging information entry with the tag
  2274. .Cf DW_TAG_inlined_subroutine .
  2275. Each such entry should be a direct child of the entry that represents the
  2276. scope within which the inlining occurs.
  2277. .P
  2278. Each inlined subroutine entry contains a 
  2279. .Cf DW_AT_low_pc
  2280. attribute, representing the address of the first
  2281. instruction associated with the given inline
  2282. expansion.   Each inlined subroutine entry also contains a
  2283. .Cf DW_AT_high_pc
  2284. attribute, representing the
  2285. address of the first location past the last instruction associated with
  2286. the inline expansion.
  2287. .P
  2288. For the remainder of this discussion,
  2289. any debugging information entry that is owned (either directly or indirectly)
  2290. by a debugging information entry with the tag 
  2291. .Cf DW_TAG_inlined_subroutine 
  2292. will be referred to as a ``concrete inlined instance entry.''
  2293. Any entry that has the tag 
  2294. .Cf DW_TAG_inlined_subroutine
  2295. will be known as
  2296. a ``concrete inlined instance root.''
  2297. Any set of concrete inlined instance entries that are all children (either
  2298. directly or indirectly) of some concrete inlined instance root, together
  2299. with the root itself, will be known as a ``concrete inlined instance
  2300. tree.''
  2301. .P
  2302. Each concrete inlined instance tree is uniquely associated with one (and
  2303. only one) abstract instance tree.
  2304. .P
  2305. .I
  2306. Note, however, that the reverse is not true.  Any given abstract instance
  2307. tree may be associated with several different concrete inlined instance
  2308. trees, or may even be associated with zero concrete inlined instance
  2309. trees.
  2310. .P
  2311. .R
  2312. Also, each separate entry within a given concrete inlined instance tree is
  2313. uniquely associated with one particular entry in the associated abstract
  2314. instance tree.  In other words, there is a one-to-one mapping from entries
  2315. in a given concrete inlined instance tree to the entries in the associated
  2316. abstract instance tree.
  2317. .P
  2318. .I
  2319. Note, however, that the reverse is not true.  A given abstract instance
  2320. tree that is associated with a given concrete inlined instance tree
  2321. may (and quite probably will) contain more entries than the associated
  2322. concrete inlined instance tree (see below).
  2323. .R
  2324. .P
  2325. Concrete inlined instance entries do not have most of the attributes (except
  2326. for 
  2327. .Cf DW_AT_low_pc , 
  2328. .Cf DW_AT_high_pc ,
  2329. .Cf DW_AT_location ,
  2330. .Cf DW_AT_return_addr ,
  2331. .Cf DW_AT_start_scope
  2332. and
  2333. .Cf DW_AT_segment )
  2334. that such entries
  2335. would otherwise normally have.  In place of these omitted attributes,
  2336. each concrete inlined instance entry has a
  2337. .Cf DW_AT_abstract_origin 
  2338. attribute that 
  2339. may be used to obtain the missing information (indirectly) from
  2340. the associated abstract instance entry.  The value of the abstract
  2341. origin attribute is a reference to the associated abstract instance entry.
  2342. .P
  2343. For each pair of entries that are associated via a
  2344. .Cf DW_AT_abstract_origin
  2345. attribute, both members of the pair will have the same tag.  So, for
  2346. example, an entry with the tag 
  2347. .Cf DW_TAG_local_variable 
  2348. can only be associated
  2349. with another entry that also has the tag 
  2350. .Cf DW_TAG_local_variable.
  2351. The only exception to this rule is that the root of a concrete
  2352. instance tree (which must always have the tag 
  2353. .Cf DW_TAG_inlined_subroutine )
  2354. can only be associated with the root of its associated abstract
  2355. instance tree (which must have the tag
  2356. .Cf DW_TAG_subprogram ).
  2357. .P
  2358. In general, the structure and content of any given concrete
  2359. instance tree will be directly analogous to the structure and content
  2360. of its associated abstract instance tree.
  2361. There are two exceptions to this general rule however.
  2362. .AL
  2363. .LI
  2364. .IX anonymous types
  2365. No entries representing anonymous types are ever made a part
  2366. of any concrete instance inlined tree.
  2367. .LI
  2368. .IX members
  2369. No entries representing members of structure, union or class
  2370. types are ever made a part of any concrete inlined instance tree.
  2371. .LE
  2372. .P
  2373. .I
  2374. Entries that represent members and anonymous types are omitted from concrete
  2375. inlined instance trees because they would simply be redundant duplicates of
  2376. the corresponding entries in the associated abstract instance trees.  If
  2377. any entry within a concrete inlined instance tree needs to refer to an
  2378. anonymous type that was declared within the scope of the
  2379. relevant inline function, the reference should simply refer to the abstract
  2380. instance entry for the given anonymous type.
  2381. .R
  2382. .P
  2383. .IX declarations, coordinates
  2384. If an entry within a concrete inlined instance tree contains
  2385. attributes describing the declaration coordinates of
  2386. that entry,
  2387. then those attributes should refer to the file, line and column
  2388. of the original declaration of the subroutine, not to the
  2389. point at which it was inlined.
  2390. .H 4 "Out-of-Line Instances of Inline Subroutines"
  2391. .IX subroutines, out-of-line
  2392. Under some conditions, compilers may need to generate concrete executable
  2393. instances of inline subroutines other than at points where those subroutines
  2394. are actually called.  For the remainder of this discussion,
  2395. such concrete instances of inline subroutines will
  2396. be referred to as ``concrete out-of-line instances.'' 
  2397. .P
  2398. .I
  2399. In C++, for example, taking the address of a function declared to be inline
  2400. can necessitate the generation of a concrete out-of-line
  2401. instance of the given function.
  2402. .P
  2403. .R
  2404. The DWARF representation of a concrete out-of-line instance of an inline
  2405. subroutine is essentially the same as for a concrete inlined instance of
  2406. that subroutine (as described in the preceding section).  The representation
  2407. of such a concrete out-of-line instance makes use of 
  2408. .Cf DW_AT_abstract_origin
  2409. attributes in exactly the same way as they are used for a concrete inlined
  2410. instance (that is, as references to corresponding entries 
  2411. within the associated
  2412. abstract instance tree) and, as for concrete instance trees, the
  2413. entries for anonymous types and for all members are omitted.
  2414. .P
  2415. The differences between the DWARF representation of a concrete out-of-line
  2416. instance of a given subroutine and the representation of a concrete inlined
  2417. instance of that same subroutine are as follows:
  2418. .AL
  2419. .LI
  2420. The root entry for a concrete out-of-line instance of a given
  2421. inline subroutine has the same tag as does its associated
  2422. (abstract) inline subroutine entry (that is, it does not have the
  2423. tag 
  2424. .Cf DW_TAG_inlined_subroutine ).
  2425. .LI
  2426. The root entry for a concrete out-of-line instance tree is
  2427. always directly owned by the same parent entry that
  2428. also owns the root entry of the associated abstract instance.
  2429. .LE
  2430. .H 2   "Lexical Block Entries"
  2431. .I
  2432. .IX lexical blocks
  2433. A lexical block is a bracketed sequence of source statements that may
  2434. contain any number of declarations.  In some languages (C and C++)
  2435. blocks can be nested within other blocks to any depth.  
  2436. .P
  2437. .R
  2438. A lexical block is represented by a debugging information entry
  2439. with the tag
  2440. .Cf DW_TAG_lexical_block .
  2441. .P
  2442. The lexical block entry has a 
  2443. .Cf DW_AT_low_pc
  2444. attribute whose value is the
  2445. relocated address of the first machine instruction generated for the lexical
  2446. block.
  2447. The lexical block entry also has a 
  2448. .Cf DW_AT_high_pc
  2449. attribute whose value is the
  2450. relocated address of the first location
  2451. past the last machine instruction generated for the lexical block.
  2452. .P
  2453. If a name has been given to the lexical block in the source program,
  2454. then the corresponding lexical block entry has a 
  2455. .Cf DW_AT_name 
  2456. attribute
  2457. whose value is a null-terminated string containing the name of the
  2458. lexical block as it appears in the source program.  
  2459. .P
  2460. .I
  2461. This is not the
  2462. same as a C or C++ label (see below).
  2463. .R
  2464. .P
  2465. The lexical block entry owns debugging information entries that
  2466. describe the declarations within that lexical block.
  2467. There is one such debugging information entry for each local declaration
  2468. of an identifier or inner lexical block.
  2469. .H 2   "Label Entries"
  2470. .I
  2471. .IX labels
  2472. A label is a way of identifying a source statement.  A labeled statement
  2473. is usually the target of one or more ``go to'' statements.
  2474. .P
  2475. .R
  2476. A label is represented by a debugging information entry
  2477. with the tag 
  2478. .Cf DW_TAG_label .
  2479. The entry for a label should be owned by
  2480. the debugging information entry representing the scope within which the name
  2481. of the label could be legally referenced within the source program.
  2482. .P
  2483. The label entry has a 
  2484. .Cf DW_AT_low_pc
  2485. attribute whose value is the
  2486. relocated address of the first machine instruction generated for the
  2487. statement identified by the label in the source program.
  2488. The label entry also has a 
  2489. .Cf DW_AT_name 
  2490. attribute
  2491. whose value is a null-terminated string containing the name of the
  2492. label as it appears in the source program.
  2493. .H 2 "With Statement Entries"
  2494. .I
  2495. .IX with statements
  2496. .IX Pascal
  2497. .IX Modula2
  2498. Both Pascal and Modula support the concept of a ``with'' statement. 
  2499. The with statement specifies a sequence of executable statements
  2500. within which the fields of a record variable may be referenced, unqualified
  2501. by the name of the record variable.
  2502. .P
  2503. .R
  2504. A with statement is represented by a debugging information entry with
  2505. the tag
  2506. .Cf DW_TAG_with_stmt .
  2507. A with statement entry has a 
  2508. .Cf DW_AT_low_pc
  2509. attribute whose value is the relocated
  2510. address of the first machine instruction generated for the body of
  2511. the with statement.  A with statement entry also has a 
  2512. .Cf DW_AT_high_pc
  2513. attribute whose value is the relocated
  2514. address of the first location after the last machine instruction generated for the body of
  2515. the statement.
  2516. .P
  2517. The with statement entry has a 
  2518. .Cf DW_AT_type
  2519. attribute, denoting
  2520. the type of record whose fields may be referenced without full qualification
  2521. within the body of the statement.  It also has a
  2522. .Cf DW_AT_location
  2523. attribute, describing how to find the base address
  2524. of the record object referenced within the body of the with statement.
  2525. .H 2 "Try and Catch Block Entries"
  2526. .I
  2527. .IX C++ %caa
  2528. .IX exceptions
  2529. .IX try blocks
  2530. .IX catch blocks
  2531. In C++ a lexical block may be designated as a ``catch block.''
  2532. A catch block is an exception handler that handles exceptions
  2533. thrown by an immediately preceding ``try block.''  A catch block
  2534. designates the type of the exception that it can handle.
  2535. .R
  2536. .P
  2537. A try block is represented by a debugging information entry
  2538. with the tag
  2539. .Cf DW_TAG_try_block .
  2540. A catch block is represented by a debugging information entry
  2541. with the tag
  2542. .Cf DW_TAG_catch_block .
  2543. Both try and catch block entries contain a
  2544. .Cf DW_AT_low_pc
  2545. attribute whose value is the
  2546. relocated address of the first machine instruction generated for that 
  2547. block.  These entries also contain a
  2548. .Cf DW_AT_high_pc
  2549. attribute whose value is the
  2550. relocated address of the first location
  2551. past the last machine instruction generated for that block.
  2552. .P
  2553. Catch block entries have at least one child entry,
  2554. an entry representing the type of exception accepted
  2555. by that catch block.  This child entry will have one of the tags
  2556. .Cf DW_TAG_formal_parameter
  2557. or
  2558. .Cf DW_TAG_unspecified_parameters ,
  2559. .IX parameters, formal
  2560. .IX parameters, unspecified
  2561. and will have the same form as other parameter entries.
  2562. .P
  2563. The first sibling of each try block entry will be a catch block
  2564. entry.
  2565. .OP
  2566. .H 1 "DATA OBJECT AND OBJECT LIST ENTRIES"
  2567. This section presents the debugging information entries that
  2568. describe individual data objects: variables, parameters and
  2569. constants, and lists of those objects that may be grouped
  2570. in a single declaration, such as a common block.
  2571. .H 2   "Data Object Entries"
  2572. .IX variables
  2573. .IX parameters, formal
  2574. .IX constants
  2575. Program variables, formal parameters and constants are represented
  2576. by debugging information entries with the tags
  2577. .Cf DW_TAG_variable ,
  2578. .Cf DW_TAG_formal_parameter
  2579. and
  2580. .Cf DW_TAG_constant ,
  2581. respectively. 
  2582. .P
  2583. .I
  2584. The tag
  2585. .Cf DW_TAG_constant
  2586. is used for languages that distinguish between variables
  2587. that may have constant value and true named constants.
  2588. .R
  2589. .P
  2590. The debugging information entry for a program variable, formal
  2591. parameter or constant may have the following attributes:
  2592. .AL
  2593. .LI
  2594. .Cf DW_AT_name 
  2595. attribute whose value is a null-terminated
  2596. string containing the data object name as it appears in the source program.
  2597. .P
  2598. .IX anonymous unions
  2599. .IX unions, anonymous
  2600. .IX C++ %caa
  2601. If a variable entry describes a C++ anonymous union, the name
  2602. attribute is omitted or consists of a single zero byte.
  2603. .LI
  2604. If the name of a variable is visible outside of its enclosing 
  2605. compilation unit, the variable entry has a
  2606. .Cf DW_AT_external
  2607. .IX declarations, external
  2608. attribute, whose value is a flag.
  2609. .I
  2610. .P
  2611. .IX members, static data
  2612. The definitions of C++ static data members
  2613. of structures or classes are represented by variable entries flagged
  2614. as external.
  2615. .IX C %c
  2616. .IX C++ %caa
  2617. Both file static and local variables in C and C++ are represented 
  2618. by non-external variable entries.
  2619. .R
  2620. .LI
  2621. A
  2622. .Cf DW_AT_location
  2623. attribute, whose value describes the location of a variable or parameter
  2624. at run-time.
  2625. .P
  2626. .IX declarations, non-defining
  2627. A data object entry representing a non-defining declaration of the object
  2628. will not have a location attribute, and will have the
  2629. .Cf DW_AT_declaration
  2630. attribute.
  2631. .P
  2632. In a variable entry representing the definition of the variable
  2633. (that is, with no
  2634. .Cf DW_AT_declaration
  2635. attribute)
  2636. if no location attribute is present, or if
  2637. the location attribute is present but describes
  2638. a null entry (as described in section 2.4), the variable
  2639. is assumed to exist in the source code but not in the executable
  2640. program (but see number 9, below).
  2641. .IX optimized code
  2642. .P
  2643. The location of a variable may be further specified with a
  2644. .Cf DW_AT_segment
  2645. attribute, if appropriate.
  2646. .IX segmented address space
  2647. .IX address space, segmented
  2648. .LI
  2649. .Cf DW_AT_type
  2650. attribute describing the type of the variable, constant or formal
  2651. parameter.
  2652. .LI
  2653. .IX members, static data
  2654. .IX declarations, defining
  2655. If the variable entry represents the defining declaration for a C++ static
  2656. data member of a structure, class or union, the entry has a
  2657. .Cf DW_AT_specification
  2658. attribute, whose value is a reference to the debugging information
  2659. entry representing the declaration of this data member.  The
  2660. referenced entry will be a child of some class, structure or
  2661. union type entry.
  2662. .IX classes
  2663. .IX structures
  2664. .IX unions
  2665. .P
  2666. Variable entries containing the 
  2667. .Cf DW_AT_specification
  2668. attribute do not need to duplicate information provided by the
  2669. declaration entry referenced by the specification attribute.
  2670. In particular, such variable entries do not need to contain
  2671. attributes for the name or type of the data member whose
  2672. definition they represent.
  2673. .LI
  2674. .I
  2675. Some languages distinguish between parameters whose value in the
  2676. calling function can be modified by the callee (variable parameters), 
  2677. and parameters whose value in the calling function cannot be modified
  2678. by the callee (constant parameters).
  2679. .P
  2680. .R
  2681. If a formal parameter entry represents a parameter whose value
  2682. in the calling function may be modified by the callee, that entry
  2683. may have a
  2684. .Cf DW_AT_variable_parameter
  2685. attribute, whose value is a flag.  The absence of this attribute
  2686. implies that the parameter's value in the calling function cannot
  2687. be modified by the callee.
  2688. .IX parameters, variable
  2689. .LI
  2690. .I
  2691. Fortran90 has the concept of an optional parameter.
  2692. .IX Fortran90
  2693. .P
  2694. .R
  2695. .IX parameters, optional
  2696. If a parameter entry represents an optional parameter, it has a
  2697. .Cf DW_AT_is_optional
  2698. attribute, whose value is a flag.
  2699. .LI
  2700. .IX parameters, default value
  2701. A formal parameter entry describing a formal parameter that has a default
  2702. value may have a
  2703. .Cf DW_AT_default_value
  2704. attribute.  The value of this attribute is a reference to the
  2705. debugging information entry for a variable or subroutine.  The
  2706. default value of the parameter is the value of the variable (which
  2707. may be constant) or the value returned by the subroutine.  If the
  2708. value of the
  2709. .Cf DW_AT_default_value
  2710. attribute is 0, it means that no default value has been specified.
  2711. .LI
  2712. .IX constants
  2713. An entry describing a variable whose value is constant
  2714. and not represented by an object in the address space of the program,
  2715. or an entry describing a named constant,
  2716. does not have a location attribute.  Such entries have a
  2717. .Cf DW_AT_const_value
  2718. attribute, whose value may be a string or any of the constant
  2719. data or data block forms, as appropriate for the representation
  2720. of the variable's value.  The value of this attribute is the actual
  2721. constant value of the variable, represented as it would be
  2722. on the target architecture.
  2723. .LI
  2724. .IX scope
  2725. .IX declarations, scope
  2726. If the scope of an object begins sometime after the low pc value
  2727. for the scope most closely enclosing the object, the
  2728. object entry may have a
  2729. .Cf DW_AT_start_scope
  2730. attribute.  The value of this attribute is the offset in bytes of the beginning
  2731. of the scope for the object from the low pc value of the debugging
  2732. information entry that defines its scope.
  2733. .P
  2734. .I
  2735. The scope of a variable may begin somewhere in the middle of a lexical
  2736. block in a language that allows executable code in a 
  2737. block before a variable declaration, or where one declaration
  2738. containing initialization code may change the scope of a subsequent
  2739. declaration.  For example, in the following C code:
  2740. .DS
  2741. \f(CWfloat x = 99.99;
  2742.  
  2743. int myfunc()
  2744. {
  2745.     float f = x;
  2746.     float x = 88.99;
  2747.  
  2748.     return 0;
  2749. }\fP
  2750. .DE
  2751. .P
  2752. ANSI-C scoping rules require that the value of the variable \f(CWx\fP
  2753. assigned to the variable \f(CWf\fP in the initialization sequence
  2754. is the value of the global variable \f(CWx\fP, rather than the local \f(CWx\fP,
  2755. because the scope of the local variable \f(CWx\fP only starts after the full
  2756. declarator for the local \f(CWx\fP.
  2757. .R
  2758. .LE
  2759. .P
  2760. .H 2 "Common Block Entries"
  2761. .IX common blocks
  2762. .IX Fortran
  2763. A Fortran common block may be described by a debugging information
  2764. entry with the tag
  2765. .Cf DW_TAG_common_block .
  2766. The common block entry has a
  2767. .Cf DW_AT_name 
  2768. attribute whose value is a null-terminated
  2769. string containing the common block name as it appears in the source program.
  2770. It also has a
  2771. .Cf DW_AT_location
  2772. attribute whose value describes the location of the beginning of the
  2773. common block.  The common block entry owns debugging information
  2774. entries describing the variables contained within the common block.
  2775. .H 2 "Imported Declaration Entries"
  2776. .I 
  2777. .IX declarations, imported
  2778. .IX imports
  2779. Some languages support the concept of importing into a given
  2780. module declarations made in a different module.
  2781. .R
  2782. .P
  2783. An imported declaration is represented by a debugging information
  2784. entry with the tag
  2785. .Cf DW_TAG_imported_declaration .
  2786. The entry for the imported declaration has a 
  2787. .Cf DW_AT_name 
  2788. attribute whose value
  2789. is a null-terminated string containing the name of the entity
  2790. whose declaration is being imported as it appears in the source
  2791. program.  The imported declaration entry also has a
  2792. .Cf DW_AT_import
  2793. attribute, whose value is a reference to the debugging information
  2794. entry representing the declaration that is being imported.
  2795. .H 2 "Namelist Entries"
  2796. .I
  2797. .IX namelists
  2798. .IX Fortran90
  2799. At least one language, Fortran90, has the concept of a namelist.
  2800. A namelist is an ordered list of the names of some set of declared objects.
  2801. The namelist object itself may be used as a replacement for the 
  2802. list of names in various contexts.
  2803. .R
  2804. .P
  2805. A namelist is represented by a debugging information entry with
  2806. the tag
  2807. .Cf DW_TAG_namelist .
  2808. If the namelist itself has a name, the namelist entry has a
  2809. .Cf DW_AT_name
  2810. attribute, whose value is a null-terminated string containing the namelist's
  2811. name as it appears in the source program.
  2812. .P
  2813. Each name that is part of the namelist is represented by a debugging
  2814. information entry with the tag 
  2815. .Cf DW_TAG_namelist_item .
  2816. Each such entry is a child of the namelist entry, and all of
  2817. the namelist item entries for a given namelist are ordered as were
  2818. the list of names they correspond to in the source program.
  2819. .P
  2820. Each namelist item entry contains a
  2821. .Cf DW_AT_namelist_item
  2822. attribute whose value is a reference to the debugging information
  2823. entry representing the declaration of the item whose name
  2824. appears in the namelist.
  2825. .OP
  2826. .H 1 "TYPE ENTRIES"
  2827. This section presents the debugging information entries
  2828. that describe program types: base types, modified types
  2829. and user-defined types.
  2830. .P
  2831. If the scope of the declaration of a named type begins sometime after 
  2832. .IX scope
  2833. .IX declarations, scope
  2834. the low pc value
  2835. for the scope most closely enclosing the declaration, the
  2836. declaration may have a
  2837. .Cf DW_AT_start_scope
  2838. attribute.  The value of this attribute is the offset in bytes of the beginning
  2839. of the scope for the declaration from the low pc value of the debugging
  2840. information entry that defines its scope.
  2841. .H 2 "Base Type Entries"
  2842. .I
  2843. .IX base types
  2844. .IX types, base
  2845. A base type is a data type that is not defined in terms of
  2846. other data types.  Each programming language has a set of
  2847. base types that are considered to be built into that language.
  2848. .R
  2849. .P
  2850. A base type is represented by a debugging information entry
  2851. with the tag
  2852. .Cf DW_TAG_base_type .
  2853. A base type entry has a 
  2854. .Cf DW_AT_name 
  2855. attribute whose value is a null-terminated
  2856. string describing the name of the base type as recognized by
  2857. the programming language of the compilation unit containing
  2858. the base type entry.
  2859. .P
  2860. A base type entry also has a
  2861. .Cf DW_AT_encoding
  2862. attribute describing how the base type is encoded and is
  2863. to be interpreted.  The value of this attribute is a constant.
  2864. The set of values and their meanings for the 
  2865. .Cf DW_AT_encoding
  2866. .nr aX \n(Fg+1
  2867. attribute is given in Figure \n(aX.
  2868. .DF
  2869. .TS
  2870. box center;
  2871. l l
  2872. lf(CW) l
  2873. Name    Meaning
  2874. _
  2875. DW_ATE_address    linear machine address
  2876. DW_ATE_boolean    true or false
  2877. DW_ATE_complex_float    complex floating-point number
  2878. DW_ATE_float    floating-point number
  2879. DW_ATE_signed    signed binary integer
  2880. DW_ATE_signed_char    signed character
  2881. DW_ATE_unsigned    unsigned binary integer
  2882. DW_ATE_unsigned_char    unsigned character
  2883. .TE
  2884. .FG "Encoding attribute values"
  2885. .DE
  2886. .P
  2887. All encodings assume the representation that is ``normal'' for
  2888. the target architecture.
  2889. .P
  2890. A base type entry has a
  2891. .Cf DW_AT_byte_size
  2892. attribute, whose value is a constant,
  2893. describing the size in bytes of the storage
  2894. unit used to represent an object of the given type.
  2895. .P
  2896. If the value of an object of the given type does not
  2897. fully occupy the storage unit described by the byte size attribute,
  2898. the base type entry may have a
  2899. .Cf DW_AT_bit_size
  2900. attribute and a
  2901. .Cf DW_AT_bit_offset
  2902. attribute, both of whose values are constants.
  2903. The bit size attribute describes the actual size in bits used
  2904. to represent a value of the given type.  The bit offset
  2905. attribute describes the offset in bits of the high order
  2906. bit of a value of the given type from the high order bit
  2907. of the storage unit used to contain that value.
  2908. .I
  2909. .P
  2910. For example, the C type 
  2911. .Cf int
  2912. on a machine that uses 32-bit integers would be
  2913. represented by a base type entry with a name
  2914. attribute whose value was ``\f(CWint\fP,'' an
  2915. encoding attribute whose value was 
  2916. .Cf DW_ATE_signed
  2917. and a byte size attribute whose value was
  2918. .Cf 4 .
  2919. .R
  2920. .H 2 "Type Modifier Entries"
  2921. .IX type modifiers
  2922. .IX types, modifiers
  2923. A base or user-defined type may be modified in different
  2924. ways in different languages.  A type modifier is represented
  2925. in DWARF by a debugging information entry with one of the
  2926. .nr aX \n(Fg+1
  2927. tags given in Figure \n(aX.
  2928. .DF
  2929. .TS
  2930. box center;
  2931. l l
  2932. lf(CW) l
  2933. Tag    Meaning
  2934. _
  2935. DW_TAG_const_type    C or C++ const qualified type
  2936. DW_TAG_packed_type    Pascal packed type
  2937. DW_TAG_pointer_type    The address of the object whose type is being modified
  2938. DW_TAG_reference_type    A C++ reference to the object whose type is being modified
  2939. DW_TAG_volatile_type    C or C++ volatile qualified type
  2940. .TE
  2941. .FG "Type modifier tags"
  2942. .DE
  2943. .P
  2944. .IX types, constant
  2945. .IX types, packed
  2946. .IX types, volatile
  2947. .IX types, pointer
  2948. .IX types, reference
  2949. Each of the type modifier entries has a
  2950. .Cf DW_AT_type
  2951. attribute, whose value is a reference to a debugging information
  2952. entry describing a base type, a user-defined type or another type 
  2953. modifier.
  2954. .P
  2955. A modified type entry describing a pointer or reference type
  2956. may have a 
  2957. .IX addresses, class
  2958. .Cf DW_AT_address_class 
  2959. attribute
  2960. to describe how objects having the given pointer or reference type
  2961. ought to be dereferenced.
  2962. .P
  2963. When multiple type modifiers are chained together to modify
  2964. a base or user-defined type, they are ordered as if part of
  2965. a right-associative expression involving the base or user-defined
  2966. type.
  2967. .I
  2968. .P
  2969. As examples of how type modifiers are ordered, take the following
  2970. C declarations:
  2971. .R
  2972. .DS
  2973. .ta .5i +.5i +.5i +.5i +.5i +.5i +.5i +.5i
  2974. \f(CWconst char * volatile p;\fP
  2975.         \fIwhich represents a volatile pointer to a constant character.\fP
  2976.         \fIThis is encoded in DWARF as:\fP
  2977.         \f(CWDW_TAG_volatile_type \(-> 
  2978.         DW_TAG_pointer_type \(->
  2979.             DW_TAG_const_type \(->
  2980.                 DW_TAG_base_type\fP
  2981.  
  2982. \f(CWvolatile char * const p;\fP
  2983.         \fIon the other hand, represents a constant pointer
  2984.         to a volatile character.\fP
  2985.         \fIThis is encoded as:\fP
  2986.         \f(CWDW_TAG_const_type \(-> 
  2987.         DW_TAG_pointer_type \(->
  2988.             DW_TAG_volatile_type \(->
  2989.                 DW_TAG_base_type\fP
  2990.  
  2991. .DE
  2992. .R
  2993. .H 2 "Typedef Entries"
  2994. .IX typedefs
  2995. Any arbitrary type named via a typedef is represented
  2996. by a debugging information entry with the tag 
  2997. .Cf DW_TAG_typedef .
  2998. The typedef entry has a 
  2999. .Cf DW_AT_name 
  3000. attribute whose value is a null-terminated
  3001. string containing the name of the typedef as it appears in the
  3002. source program.
  3003. The typedef entry also contains a 
  3004. .Cf DW_AT_type
  3005. attribute.
  3006. .P
  3007. If the debugging information entry for a typedef represents a 
  3008. declaration of the type that is not also a definition,
  3009. it does not contain a type attribute.
  3010. .IX declarations, non-defining
  3011. .H 2     "Array Type Entries"
  3012. .I
  3013. .IX arrays
  3014. Many languages share the concept of an ``array,'' which is a
  3015. table of components of identical type.
  3016. .P
  3017. .R
  3018. An array type is represented by a debugging information entry with
  3019. the tag 
  3020. .Cf DW_TAG_array_type .
  3021. .P
  3022. If a name has been given to the array type in the source program, then the
  3023. corresponding array type entry has a 
  3024. .Cf DW_AT_name 
  3025. attribute whose value is a
  3026. null-terminated string containing the array type name as it appears in the
  3027. source program.
  3028. .P
  3029. .IX arrays, ordering
  3030. The array type entry describing a multidimensional array may have a
  3031. .Cf DW_AT_ordering
  3032. attribute whose constant value is interpreted to mean either
  3033. row-major or column-major ordering of array elements.
  3034. The set of values and their meanings for the ordering attribute
  3035. .nr aX \n(Fg+1
  3036. are listed in Figure \n(aX.
  3037. If no ordering attribute is present, the default ordering for
  3038. the source language (which is indicated by the
  3039. .Cf DW_AT_language
  3040. attribute of the enclosing compilation unit entry)
  3041. is assumed.
  3042. .DF
  3043. .TS
  3044. box center;
  3045. lf(CW)
  3046. DW_ORD_col_major
  3047. DW_ORD_row_major
  3048. .TE
  3049. .FG "Array ordering"
  3050. .DE
  3051. .P
  3052. The ordering attribute may optionally appear on one-dimensional arrays; it
  3053. will be ignored.
  3054. .P
  3055. An array type entry has a 
  3056. .Cf DW_AT_type
  3057. attribute describing the type
  3058. of each element of the array.
  3059. .P
  3060. .IX arrays, stride
  3061. If the amount of storage allocated to hold each element of an object of
  3062. the given array type is different from the amount of storage that is normally
  3063. allocated to hold an individual object of the indicated element type, then
  3064. the array type entry has a
  3065. .Cf DW_AT_stride_size 
  3066. attribute, whose constant value
  3067. represents the size in bits of each element of the array.
  3068. .P
  3069. If the size of the entire array can be determined statically at compile
  3070. time, the array type entry may have a
  3071. .Cf DW_AT_byte_size 
  3072. attribute, whose constant value represents the total size in bytes of an
  3073. instance of the array type.
  3074. .P
  3075. .I
  3076. Note that if the size of the array can be determined statically at
  3077. compile time, this value can usually be computed by multiplying
  3078. the number of array elements by the size of each element.
  3079. .P
  3080. .R
  3081. Each array dimension is described by a debugging information
  3082. entry with either the tag
  3083. .IX subranges
  3084. .IX enumerations
  3085. .IX arrays, dimensions
  3086. .Cf DW_TAG_subrange_type
  3087. or the tag
  3088. .Cf DW_TAG_enumeration_type .
  3089. These entries are children of the array type entry and are
  3090. ordered to reflect the appearance of the dimensions in the source
  3091. program (i.e. leftmost dimension first, next to leftmost second,
  3092. and so on).
  3093. .P
  3094. .I
  3095. .IX C %c
  3096. In languages, such as ANSI-C, in which there is no concept of a
  3097. ``multidimensional array,'' 
  3098. an array of arrays may be represented by a debugging information entry
  3099. for a multidimensional array.
  3100. .R
  3101. .H 2     "Structure, Union, and Class Type Entries"
  3102. .I
  3103. The languages C, C++, and Pascal, among others, 
  3104. allow the programmer to define types that
  3105. are collections of related components.  In C and C++, these collections are
  3106. called ``structures.''  In Pascal, they are called ``records.''  The components
  3107. may be of different types.  The components are called ``members'' in C and
  3108. C++, and ``fields'' in Pascal.
  3109. .P
  3110. .IX structures
  3111. .IX classes
  3112. .IX unions
  3113. .IX records
  3114. .IX C %c
  3115. .IX C++ %caa
  3116. .IX Pascal
  3117. The components of these collections each exist in their own space in
  3118. computer memory.  The components of a C or C++ ``union'' all coexist in
  3119. the same memory.
  3120. .P
  3121. Pascal and other languages have a ``discriminated union,'' also called a
  3122. .IX variants
  3123. .IX discriminated unions
  3124. ``variant record.''  Here, selection of a number of alternative substructures
  3125. (``variants'') is based on the value of a component that is not part of any of
  3126. those substructures (the ``discriminant'').
  3127. .P
  3128. Among the languages discussed in this document,
  3129. the ``class'' concept is unique to C++.  A class is similar to a structure.
  3130. A C++ class or structure may have ``member functions'' which are subroutines
  3131. that are within the scope of a class or structure.
  3132. .R
  3133. .H 3 "General Structure Description"
  3134. Structure, union, and class types are represented by 
  3135. debugging information entries with the tags
  3136. .Cf DW_TAG_structure_type ,
  3137. .Cf DW_TAG_union_type 
  3138. and 
  3139. .Cf DW_TAG_class_type ,
  3140. respectively.
  3141. If a name has been given to the structure, union, or class in the source
  3142. program, then the corresponding structure type, union type, or class type
  3143. entry has a 
  3144. .Cf DW_AT_name 
  3145. attribute whose value is a null-terminated string
  3146. containing the type name as it appears in the source program.
  3147. .P
  3148. If the size of an instance of the
  3149. structure type, union type, or class type entry can be determined
  3150. statically at compile time, the entry has a
  3151. .Cf DW_AT_byte_size 
  3152. attribute whose constant value is the number of bytes required to
  3153. hold an instance of the structure, union, or class, and any padding bytes.
  3154. .I
  3155. .P
  3156. .IX structures, incomplete
  3157. .IX classes, incomplete
  3158. .IX unions, incomplete
  3159. For C and C++, an incomplete structure, union or class type is represented
  3160. by a structure, union or class entry that does not have
  3161. a byte size attribute and that has a
  3162. .Cf DW_AT_declaration
  3163. attribute.
  3164. .R
  3165. .P
  3166. The members of a structure, union, or class are represented by
  3167. debugging information entries that are owned by the corresponding
  3168. structure type, union type, or class type entry and appear in the same
  3169. order as the corresponding declarations in the source program.
  3170. .P
  3171. .I
  3172. .IX declarations, defining
  3173. .IX members, static data
  3174. .IX members, data
  3175. .IX members, functions
  3176. Data member declarations occurring within the declaration of a structure,
  3177. union or class type are considered to be ``definitions'' of those members,
  3178. with the exception of C++ ``static'' data members, whose definitions
  3179. appear outside of the declaration of the enclosing structure, union
  3180. or class type.  Function member declarations appearing within a structure,
  3181. union or class type declaration are definitions only if the body
  3182. of the function also appears within the type declaration.
  3183. .R
  3184. .P
  3185. .IX declarations, non-defining
  3186. If the definition for a given member of the structure, union or class
  3187. does not appear within the body of the declaration, that member
  3188. also has a debugging information entry describing its definition.
  3189. That entry will have a
  3190. .Cf DW_AT_specification
  3191. attribute referencing 
  3192. the debugging entry owned by the
  3193. body of the structure, union or class debugging entry and representing
  3194. a non-defining declaration of the data or function member.  The 
  3195. referenced entry will
  3196. not have information about the location of that member (low and high
  3197. pc attributes for function members, location descriptions for data
  3198. members) and will have a
  3199. .Cf DW_AT_declaration
  3200. attribute.
  3201. .H 3 "Derived Classes and Structures"
  3202. .IX classes, derived
  3203. .IX structures, derived
  3204. .IX inheritance
  3205. The class type or structure type entry that describes a derived class 
  3206. or structure owns debugging information entries describing each of
  3207. the classes or structures it is derived from, ordered as they were
  3208. in the source program.  Each such entry has the tag
  3209. .Cf DW_TAG_inheritance .
  3210. .P
  3211. An inheritance entry has a 
  3212. .Cf DW_AT_type
  3213. attribute whose
  3214. value is a reference to the debugging information entry describing
  3215. the structure or class from which the parent structure or class
  3216. of the inheritance entry is derived.  It also has a
  3217. .Cf DW_AT_data_member_location
  3218. attribute, whose value is a location description describing
  3219. the location of the beginning of
  3220. the data members contributed to the entire class by this
  3221. subobject relative to the beginning address of the data members of the
  3222. entire class.
  3223. .P
  3224. .IX accessibility
  3225. .IX virtuality
  3226. .IX classes, virtual base
  3227. An inheritance entry may have a
  3228. .Cf DW_AT_accessibility
  3229. attribute.
  3230. If no accessibility attribute is present,
  3231. private access is assumed.
  3232. If the structure or class referenced by the inheritance entry serves
  3233. as a virtual base class, the inheritance entry has a
  3234. .Cf DW_AT_virtuality
  3235. attribute.
  3236. .P 
  3237. .I
  3238. In C++, a derived class may contain access declarations that
  3239. change the accessibility of individual class members from
  3240. the overall accessibility specified by the inheritance declaration.
  3241. A single access declaration may refer to a set of overloaded
  3242. names.
  3243. .R
  3244. .P
  3245. If a derived class or structure contains access declarations,
  3246. .IX access declarations
  3247. .IX C++ %caa
  3248. each such declaration may be represented by a debugging information
  3249. entry with the tag
  3250. .Cf DW_TAG_access_declaration .
  3251. Each such entry is a child of the structure or class type entry.
  3252. .P
  3253. An access declaration entry has a 
  3254. .Cf DW_AT_name 
  3255. attribute, whose value
  3256. is a null-terminated string representing the name used in the
  3257. declaration in the source program, including any class or structure
  3258. qualifiers.
  3259. .P
  3260. An access declaration entry also has a 
  3261. .Cf DW_AT_accessibility
  3262. attribute
  3263. describing the declared accessibility of the named entities.
  3264. .H 3 "Friends"
  3265. .IX friends
  3266. .IX classes, friends
  3267. Each ``friend'' declared by
  3268. a structure, union or class type may be represented by
  3269. a debugging information entry that is a child of the structure,
  3270. union or class type entry; the friend entry has the tag
  3271. .Cf DW_TAG_friend.
  3272. .P
  3273. A friend entry has a
  3274. .Cf DW_AT_friend 
  3275. attribute, whose value is a reference to the debugging information
  3276. entry describing the declaration of the friend.
  3277. .H 3 "Structure Data Member Entries"
  3278. .IX members, data
  3279. A data member (as opposed to a member function) is represented by
  3280. a debugging information entry with the tag
  3281. .Cf DW_TAG_member .
  3282. The member entry for a named member has a 
  3283. .Cf DW_AT_name 
  3284. attribute
  3285. whose value is a null-terminated string containing the member name
  3286. as it appears in the source program.  If the member entry describes
  3287. a C++ anonymous union, the name attribute is omitted or consists
  3288. of a single zero byte.
  3289. .IX unions, anonymous
  3290. .IX anonymous unions
  3291. .P
  3292. The structure data member entry has a 
  3293. .Cf DW_AT_type
  3294. attribute
  3295. to denote the type of that member.
  3296. .P
  3297. If the member entry is defined in the structure or class body, it has a
  3298. .Cf DW_AT_data_member_location
  3299. attribute whose value is a location
  3300. description that describes the location of that
  3301. member relative to the base address of the structure, union, or class that
  3302. most closely encloses the corresponding member declaration.
  3303. .I
  3304. .P
  3305. .IX locations, expressions
  3306. .IX locations, descriptions
  3307. The addressing expression represented by the location 
  3308. description for a structure data member expects the base address
  3309. of the structure data member to be on the expression stack
  3310. before being evaluated.
  3311. .P
  3312. .IX unions
  3313. The location description for a data member of a union may be omitted,
  3314. since all data members of a union begin at the same address.
  3315. .R
  3316. .P
  3317. .IX bit fields
  3318. .IX members, bit fields
  3319. If the member entry describes a bit field, then that entry has the following
  3320. attributes:
  3321. .AL
  3322. .LI
  3323. A
  3324. .Cf DW_AT_byte_size
  3325. attribute whose constant value is the number of bytes that
  3326. contain an instance of the bit field and any padding bits.
  3327. .P
  3328. .I
  3329. The byte size attribute may be omitted if the size of the object containing
  3330. the bit field can be inferred from the type attribute of the data
  3331. member containing the bit field.
  3332. .R
  3333. .LI
  3334. A
  3335. .Cf DW_AT_bit_offset
  3336. attribute whose constant value is the number of bits
  3337. to the left of the leftmost (most significant) bit of the bit field value.
  3338. .LI
  3339. A
  3340. .Cf DW_AT_bit_size
  3341. attribute whose constant value is the number of bits occupied
  3342. by the bit field value.
  3343. .LE
  3344. .P
  3345. The location description for a bit field calculates the address of
  3346. an anonymous object containing the bit field.  The address is
  3347. relative to the structure, union, or class that
  3348. most closely encloses the bit field declaration.  The number
  3349. of bytes in this anonymous object is the value of the byte
  3350. size attribute of the bit field.  The offset (in bits)
  3351. from the most significant bit of the
  3352. anonymous object to the most significant bit of the bit field is the
  3353. value of the bit offset attribute.
  3354. .I
  3355. .P
  3356. For example, take one possible representation of the following
  3357. structure definition in both big and little endian byte orders:
  3358. .DS
  3359. \f(CW
  3360. struct S {
  3361.     int   j:5;
  3362.     int   k:6;
  3363.     int   m:5;
  3364.     int   n:8;
  3365. };\fP
  3366. .DE
  3367. .P
  3368. In both cases, the location descriptions for the debugging information
  3369. entries for \f(CWj\fP, \f(CWk\fP, \f(CWm\fP and \f(CWn\fP
  3370. describe the address of
  3371. the same 32-bit word that contains all three members.  
  3372. (In the big-endian case,
  3373. the location description addresses the most significant byte, in
  3374. the little-endian case, the least significant). 
  3375. The following diagram shows the structure layout and lists the bit
  3376. offsets for each case.  The offsets
  3377. are from the most significant bit of the object addressed by the location
  3378. description. 
  3379. .PS
  3380. bitht = .3
  3381. boxht = bitht
  3382. bitwid = .11
  3383. nibwid = .75 * bitwid
  3384. bytewid = 8 * bitwid
  3385. boxwid = bytewid
  3386. define nibble X    # nibble(len, "label", hi-left, hi-right, lo-left, lo-right, any)
  3387. N:    box width $1*nibwid $2 $7
  3388.     { if $3 >= 0 then % "\s-4\|$3\s0" at N.w + (0,bitht/3) ljust %
  3389.     } # curly on separate line for pic bug
  3390.     { if $4 >= 0 then % "\s-4\|$4\s0" at N.e + (0,bitht/3) rjust %
  3391.     } 
  3392.     { if $5 >= 0 then % "\s-4\|$5\s0" at N.w - (0,bitht/3) ljust %
  3393.     }
  3394.     { if $6 >= 0 then % "\s-4$6\|\s0" at N.e - (0,bitht/3) rjust %
  3395.     }
  3396. X
  3397. define tbox X # tbox(width,"label", any)
  3398. T:    box width $1*nibwid ht 1/6 $3 invis
  3399.     { $2 at T.w ljust
  3400.     }
  3401. X
  3402. .PE
  3403. .DS
  3404. .PS
  3405.     down
  3406. H:    tbox(20,"Bit Offsets:")
  3407.     tbox(20,"\f(CW    j:0\fP")
  3408.     tbox(20,"\f(CW    k:5\fP")
  3409.     tbox(20,"\f(CW    m:11\fP")
  3410.     tbox(20,"\f(CW    n:16\fP")
  3411.     right
  3412. H:    tbox(32, "Big-Endian", with .w at H.e)
  3413. H:    nibble(5,"\f(CWj\fP",0,-1,31,-1,with .nw at H.sw)
  3414. H:    nibble(6,"\f(CWk\fP",-1,-1,26,-1)
  3415. H:    nibble(5,"\f(CWm\fP",-1,-1,20,-1)
  3416. H:    nibble(8,"\f(CWn\fP",-1,-1,15,-1)
  3417. H:    nibble(8,"\fIpad\fP",-1,-1,7,0)
  3418. .PE
  3419. .DE
  3420. .DS
  3421. .PS
  3422.     down
  3423. H:    tbox(20,"Bit Offsets:")
  3424.     tbox(20,"\f(CW    j:27\fP")
  3425.     tbox(20,"\f(CW    k:21\fP")
  3426.     tbox(20,"\f(CW    m:16\fP")
  3427.     tbox(20,"\f(CW    n:8\fP")
  3428.     right
  3429. H:    tbox(32, "Little-Endian", with .w at H.e)
  3430. H:    nibble(8,"\f2pad\fP",-1,-1,31,-1, with .nw at H.sw)
  3431. H:    nibble(8,"\f(CWn\fP",-1,-1,23,-1)
  3432. H:    nibble(5,"\f(CWm\fP",-1,-1,15,-1)
  3433. H:    nibble(6,"\f(CWk\fP",-1,-1,10,-1)
  3434. H:    nibble(5,"\f(CWj\fP",-1,0,4,0)
  3435. .PE
  3436. .DE
  3437. .R
  3438. .H 3 "Structure Member Function Entries"
  3439. .IX subroutines, members
  3440. .IX members, functions
  3441. .IX members, locations
  3442. A member function is represented in the debugging information by a
  3443. debugging information entry with the tag 
  3444. .Cf DW_TAG_subprogram .
  3445. The member function entry may contain the same attributes and follows
  3446. the same rules as non-member global subroutine entries (see section 3.3).
  3447. .P
  3448. .IX virtuality
  3449. .IX virtual functions
  3450. If the member function entry describes a virtual function, then that entry
  3451. has a 
  3452. .Cf DW_AT_virtuality 
  3453. attribute.
  3454. .P
  3455. An entry for a virtual function also has a
  3456. .Cf DW_AT_vtable_elem_location
  3457. attribute whose value contains a location
  3458. description yielding the address of the slot for the function
  3459. within the virtual function table for the enclosing class or structure.
  3460. .P
  3461. .IX declarations, defining
  3462. If a subroutine entry represents the defining declaration
  3463. of a member function and that definition appears outside
  3464. of the body of the enclosing class or structure declaration,
  3465. the subroutine entry has a
  3466. .Cf DW_AT_specification
  3467. attribute, whose value is a reference to the debugging information
  3468. entry representing the declaration of this function member.  The
  3469. referenced entry will be a child of some class or structure
  3470. type entry.
  3471. .P
  3472. Subroutine entries containing the 
  3473. .Cf DW_AT_specification
  3474. attribute do not need to duplicate information provided by the
  3475. declaration entry referenced by the specification attribute.
  3476. In particular, such entries do not need to contain
  3477. attributes for the name or return type of the function member whose
  3478. definition they represent.
  3479. .H 3 "Class Template Instantiations"
  3480. .I
  3481. .IX C++ %caa
  3482. .IX templates
  3483. In C++ a class template is a generic
  3484. definition of a class type that
  3485. is instantiated differently when an instance of the class
  3486. is declared or defined.  The generic description of the class
  3487. may include both parameterized types and parameterized constant
  3488. values.  DWARF does not represent the generic
  3489. template definition, but does represent each instantiation.
  3490. .R
  3491. .P
  3492. A class template instantiation is represented by a debugging information
  3493. with the tag
  3494. .Cf DW_TAG_class_type .
  3495. With four exceptions,
  3496. such an entry will contain the same attributes and have the same
  3497. types of child entries as would an entry for a class type defined 
  3498. explicitly using the instantiation types and values.
  3499. The exceptions are:
  3500. .AL
  3501. .LI 
  3502. Each formal parameterized type declaration appearing in the
  3503. template definition is represented by a debugging information entry
  3504. with the tag 
  3505. .Cf DW_TAG_template_type_parameter .
  3506. Each such entry has a 
  3507. .Cf DW_AT_name 
  3508. attribute, whose value is a null-terminated
  3509. string containing the name of the formal type parameter as it
  3510. appears in the source program.  The template type parameter
  3511. entry also has a 
  3512. .Cf DW_AT_type
  3513. attribute describing the actual type by
  3514. which the formal is replaced for this instantiation.
  3515. .LI
  3516. Each formal parameterized value declaration appearing
  3517. in the templated definition is represented by a debugging information
  3518. entry with the tag
  3519. .Cf DW_TAG_template_value_parameter .
  3520. Each such entry has a 
  3521. .Cf DW_AT_name 
  3522. attribute, whose value is a null-terminated
  3523. string containing the name of the formal value parameter as it
  3524. appears in the source program.  The template value parameter
  3525. entry also has a 
  3526. .Cf DW_AT_type
  3527. attribute describing the type of the parameterized
  3528. value.  Finally, the template value parameter entry has a
  3529. .Cf DW_AT_const_value
  3530. attribute, whose value is the actual constant value of the value
  3531. parameter for this instantiation as represented on the target
  3532. architecture.
  3533. .LI
  3534. .IX compilation units
  3535. If the compiler has generated a special compilation unit
  3536. to hold the template instantiation and that compilation unit
  3537. has a different name
  3538. from the compilation unit containing the template definition,
  3539. the name attribute for the debugging entry representing
  3540. that compilation unit should be empty or omitted.
  3541. .LI
  3542. .IX declarations, coordinates
  3543. If the class type entry representing the template instantiation
  3544. or any of its child entries
  3545. contain declaration coordinate attributes, those attributes
  3546. should refer to the source for the template definition, not
  3547. to any source generated artificially by the compiler.
  3548. .LE
  3549. .H 3 "Variant Entries"
  3550. .IX variants
  3551. .IX discriminated unions
  3552. A variant part of a structure is represented by a debugging
  3553. information entry with the tag
  3554. .Cf DW_TAG_variant_part
  3555. and is owned by the corresponding structure type
  3556. entry. 
  3557. .P
  3558. .IX discriminants
  3559. If the variant part has a discriminant, the discriminant is represented
  3560. by a separate debugging information entry which is a child of 
  3561. the variant part entry.  This entry has the form of a structure data member
  3562. entry.
  3563. The variant part entry will have a
  3564. .Cf DW_AT_discr
  3565. attribute whose value is a
  3566. reference to the member entry for the discriminant.  
  3567. .P
  3568. If the variant part
  3569. does not have a discriminant (tag field), the variant part entry has a 
  3570. .Cf DW_AT_type
  3571. attribute to represent the tag type.
  3572. .P
  3573. Each variant of a particular variant part is represented by a debugging
  3574. information entry with the tag
  3575. .Cf DW_TAG_variant 
  3576. and is a child of the variant part entry.  The value that selects a 
  3577. given variant may be represented in one of three ways.  The
  3578. variant entry may have a
  3579. .Cf DW_AT_discr_value
  3580. attribute whose value represents a single case label.  
  3581. The value of this attribute
  3582. is encoded as an LEB128 number.  The number is signed if the tag
  3583. type for the variant part containing this variant is
  3584. a signed type.   The number is unsigned if the tag type is an unsigned type.
  3585. .P
  3586. Alternatively, the variant entry may contain a
  3587. .Cf DW_AT_discr_list
  3588. attribute, whose value represents a list of discriminant values.
  3589. This list is represented by any of the block forms and may contain
  3590. a mixture of case labels and label ranges.  Each item on the list
  3591. is prefixed with a discriminant value descriptor that determines whether
  3592. the list item represents a single label or a label range.
  3593. A single case label is represented as an LEB128 
  3594. number as defined above
  3595. for the
  3596. .Cf DW_AT_discr_value
  3597. attribute.  A label range is represented by two LEB128 numbers,
  3598. the low value of the range followed by the high value.  Both values
  3599. follow the rules for signedness just described.  
  3600. The discriminant value descriptor is a constant that may have
  3601. .nr aX \n(Fg+1
  3602. one of the values given in Figure \n(aX.
  3603. .DF
  3604. .TS
  3605. center box;
  3606. lf(CW)
  3607. .
  3608. DW_DSC_label
  3609. DW_DSC_range
  3610. .TE
  3611. .FG "Discriminant descriptor values"
  3612. .DE
  3613. .P
  3614. If a variant entry has neither a
  3615. .Cf DW_AT_discr_value
  3616. attribute nor a
  3617. .Cf DW_AT_discr_list
  3618. attribute, or if it has a
  3619. .Cf DW_AT_discr_list
  3620. attribute with 0 size, the variant is a default variant.
  3621. .P
  3622. The components selected by a particular variant are represented
  3623. by debugging information entries owned by the corresponding variant
  3624. entry and appear in the same order as the corresponding declarations in
  3625. the source program.
  3626. .H 2     "Enumeration Type Entries"
  3627. .I
  3628. .IX enumerations
  3629. An ``enumeration type'' is a scalar that can assume one of a fixed number of
  3630. symbolic values.
  3631. .P
  3632. .R
  3633. An enumeration type is represented by a debugging information entry
  3634. with the tag
  3635. .Cf DW_TAG_enumeration_type .
  3636. .P
  3637. If a name has been given to the enumeration type in the source program,
  3638. then the corresponding enumeration type entry has a 
  3639. .Cf DW_AT_name 
  3640. attribute
  3641. whose value is a null-terminated string containing the enumeration type
  3642. name as it appears in the source program.
  3643. These entries also have a 
  3644. .Cf DW_AT_byte_size 
  3645. attribute whose
  3646. constant value is the number of bytes required to hold an
  3647. instance of the enumeration.
  3648. .P
  3649. Each enumeration literal is represented by a debugging information
  3650. entry with the tag
  3651. .Cf DW_TAG_enumerator .
  3652. Each such entry is a child of the enumeration type entry, and
  3653. the enumerator entries appear in the same order as the declarations of
  3654. the enumeration literals in the source program.
  3655. .P
  3656. Each enumerator entry has a 
  3657. .Cf DW_AT_name 
  3658. attribute, whose value is
  3659. a null-terminated string containing the name of the enumeration
  3660. literal as it appears in the source program.  Each enumerator
  3661. entry also has a
  3662. .Cf DW_AT_const_value
  3663. attribute, whose value is the actual numeric value of the enumerator
  3664. as represented on the target system.
  3665. .H 2     "Subroutine Type Entries"
  3666. .I
  3667. .IX subroutines, types
  3668. It is possible in C to declare pointers to subroutines that return a value
  3669. of a specific type.  In both ANSI C and C++, it is possible to declare
  3670. pointers to subroutines that not only return a value of a specific type,
  3671. but accept only arguments of specific types.  The type of such pointers
  3672. would be described with a ``pointer to'' modifier applied to a user-defined
  3673. type.  
  3674. .R
  3675. .P
  3676. A subroutine type is represented by a debugging information entry
  3677. with the tag
  3678. .Cf DW_TAG_subroutine_type .
  3679. If a name has been given to the subroutine type in the source program,
  3680. then the corresponding subroutine type entry has a 
  3681. .Cf DW_AT_name 
  3682. attribute
  3683. whose value is a null-terminated string containing the subroutine type
  3684. name as it appears in the source program.
  3685. .P
  3686. .IX subroutines, return types
  3687. If the subroutine type describes a function that returns a value, then
  3688. the subroutine type entry has a 
  3689. .Cf DW_AT_type
  3690. attribute
  3691. to denote the type returned by the subroutine.
  3692. If the types of the arguments are necessary to describe the subroutine type,
  3693. then the corresponding subroutine type entry owns debugging
  3694. information entries that describe the arguments.
  3695. These debugging information entries appear in the order
  3696. that the corresponding argument types appear in the source program.
  3697. .P
  3698. .I
  3699. .IX C %c
  3700. .IX subroutines, prototypes
  3701. In ANSI-C there is a difference between the types of functions
  3702. declared using function prototype style declarations and those
  3703. declared using non-prototype declarations.  
  3704. .P
  3705. .R
  3706. A subroutine entry
  3707. declared with a function prototype style declaration may have a
  3708. .Cf DW_AT_prototyped
  3709. attribute, whose value is a flag.
  3710. .P
  3711. Each debugging information entry
  3712. owned by a subroutine type entry has a tag whose value has one of
  3713. two possible interpretations.  
  3714. .AL
  3715. .LI
  3716. .IX parameters, formal
  3717. Each debugging information entry that is owned by a subroutine type entry and
  3718. that defines a single argument of a specific type has the tag
  3719. .Cf DW_TAG_formal_parameter .
  3720. .P
  3721. The formal parameter entry has a type attribute
  3722. to denote the type of the corresponding formal parameter.
  3723. .LI
  3724. The unspecified parameters of a variable parameter list are represented by a
  3725. debugging information entry owned by the subroutine type entry with the tag
  3726. .Cf DW_TAG_unspecified_parameters .
  3727. .IX parameters, unspecified
  3728. .LE
  3729. .H 2     "String Type Entries"
  3730. .I
  3731. .IX string types
  3732. .IX Fortran
  3733. A ``string'' is a sequence of characters that have specific semantics and
  3734. operations that separate them from arrays of characters.  
  3735. Fortran is one of
  3736. the languages that has a string type.
  3737. .R
  3738. .P
  3739. A string type is represented by a debugging information entry
  3740. with the tag 
  3741. .Cf DW_TAG_string_type .
  3742. If a name has been given to the string type in the source program,
  3743. then the corresponding string type entry has a 
  3744. .Cf DW_AT_name 
  3745. attribute
  3746. whose value is a null-terminated string containing the string type
  3747. name as it appears in the source program.
  3748. .P
  3749. The string type entry may have a
  3750. .Cf DW_AT_string_length
  3751. attribute whose value is a location description
  3752. yielding the location where the length of the string
  3753. is stored in the program.  The string type entry may also have a
  3754. .Cf DW_AT_byte_size 
  3755. attribute, whose constant value is the size in bytes of the data
  3756. to be retrieved from the location referenced by the string length
  3757. attribute.  If no byte size attribute is present, the size of the
  3758. data to be retrieved is the same as the size of an address on
  3759. the target machine.
  3760. .P
  3761. If no string length attribute is present, the string type entry may have
  3762. .Cf DW_AT_byte_size 
  3763. attribute, whose constant value is the length in bytes of
  3764. the string.
  3765. .H 2 "Set Entries"
  3766. .I
  3767. Pascal provides the concept of a ``set,'' which represents a group of
  3768. values of ordinal type.
  3769. .P
  3770. .R
  3771. .IX Pascal
  3772. .IX set types
  3773. A set is represented by a debugging information entry
  3774. with the tag
  3775. .Cf DW_TAG_set_type .
  3776. If a name has been given to the set type,
  3777. then the set type entry has a 
  3778. .Cf DW_AT_name 
  3779. attribute
  3780. whose value is a null-terminated string containing the set type name
  3781. as it appears in the source program.
  3782. .P
  3783. The set type entry has a 
  3784. .Cf DW_AT_type
  3785. attribute to denote the type 
  3786. of an element of the set.  
  3787. .P
  3788. If the amount of storage allocated to hold each element of an object of
  3789. the given set type is different from the amount of storage that is normally
  3790. allocated to hold an individual object of the indicated element type, then
  3791. the set type entry has a 
  3792. .Cf DW_AT_byte_size 
  3793. attribute, whose constant value
  3794. represents the size in bytes of an instance of the set type.
  3795. .H 2 "Subrange Type Entries"
  3796. .I
  3797. Several languages support the concept of a ``subrange'' type object.
  3798. These objects can represent a subset of the values that an
  3799. object of the basis type for the subrange can represent.
  3800. Subrange type entries may also be used to represent the bounds
  3801. of array dimensions.
  3802. .R
  3803. .P
  3804. .IX subranges
  3805. A subrange type is represented by a debugging information entry
  3806. with the tag
  3807. .Cf DW_TAG_subrange_type .
  3808. If a name has been given to the subrange type,
  3809. then the subrange type entry has a 
  3810. .Cf DW_AT_name 
  3811. attribute
  3812. whose value is a null-terminated string containing the subrange type name
  3813. as it appears in the source program.
  3814. .P
  3815. The subrange entry may have a 
  3816. .Cf DW_AT_type
  3817. attribute to describe
  3818. the type of object of whose values this subrange is a subset.
  3819. .P
  3820. If the amount of storage allocated to hold each element of an object of
  3821. the given subrange type is different from the amount of storage that is normally
  3822. allocated to hold an individual object of the indicated element type, then
  3823. the subrange type entry has a
  3824. .Cf DW_AT_byte_size 
  3825. attribute, whose constant value
  3826. represents the size in bytes of each element of the subrange type.
  3827. .P
  3828. The subrange entry may have the attributes
  3829. .Cf DW_AT_lower_bound
  3830. and
  3831. .Cf DW_AT_upper_bound
  3832. to describe, respectively, the lower and upper bound values
  3833. of the subrange.
  3834. The 
  3835. .Cf DW_AT_upper_bound
  3836. attribute may be replaced by a
  3837. .Cf DW_AT_count
  3838. attribute, whose value describes the number of elements in
  3839. the subrange rather than the value of the last element.
  3840. If a bound or count value is described by a constant
  3841. not represented in the program's address space and can
  3842. be represented by one of the constant attribute forms, then the value
  3843. of the lower or upper bound or count attribute may be one of the constant
  3844. types.  Otherwise, the value of the lower or upper bound or count
  3845. attribute is a reference to a debugging information entry describing
  3846. an object containing the bound value or itself describing a constant
  3847. value. 
  3848. .P
  3849. If either the lower or upper bound or count values are missing, the
  3850. bound value is assumed to be a language-dependent default
  3851. constant.
  3852. .P
  3853. .I
  3854. .IX C %c
  3855. .IX C++ %caa
  3856. .IX Fortran
  3857. The default lower bound value for C or C++ is 0.  For Fortran,
  3858. it is 1.  No other default values are currently defined by DWARF.
  3859. .R
  3860. .P
  3861. If the subrange entry has no type attribute describing the basis
  3862. type, the basis type is assumed to be the same as the object
  3863. described by the lower bound attribute (if it references an object).
  3864. If there is no lower bound attribute, or it does not reference
  3865. an object, the basis type is the type of the upper bound or count
  3866. attribute
  3867. (if it references an object).  If there is no upper bound or count attribute
  3868. or it does not reference an object, the type is assumed to be
  3869. the same type, in the source language
  3870. of the compilation unit containing the subrange entry,
  3871. as a signed integer with the same size
  3872. as an address on the target machine.
  3873. .H 2 "Pointer to Member Type Entries"
  3874. .I
  3875. In C++, a pointer to a data or function member of a class or
  3876. structure is a unique type.  
  3877. .P
  3878. .R
  3879. .IX C++ %caa
  3880. .IX members, pointers to
  3881. .IX pointers to members
  3882. A debugging information entry
  3883. representing the type of an object that is a pointer to a structure
  3884. or class member has the tag
  3885. .Cf DW_TAG_ptr_to_member_type .
  3886. .P
  3887. If the pointer to member type has a name, the pointer to member entry
  3888. has a 
  3889. .Cf DW_AT_name 
  3890. attribute, whose value is a null-terminated string
  3891. containing the type name as it appears in the source program.
  3892. .P
  3893. The pointer to member entry has a
  3894. .Cf DW_AT_type
  3895. attribute to describe
  3896. the type of the class or structure member to which objects
  3897. of this type may point.
  3898. .P
  3899. The pointer to member entry also has a
  3900. .Cf DW_AT_containing_type
  3901. attribute, whose value is a reference to a debugging information
  3902. entry for the class or structure to whose members objects of
  3903. this type may point.
  3904. .P
  3905. Finally, the pointer to member entry has a
  3906. .Cf DW_AT_use_location
  3907. attribute whose value is a location description that computes
  3908. the address of the member of the class or structure to which the
  3909. pointer to member type entry can point.
  3910. .P
  3911. .I
  3912. The method used to find the address of a given member
  3913. of a class or structure is common to any instance of that
  3914. class or structure and to any instance of the pointer or
  3915. member type.  The method is thus associated
  3916. with the type entry, rather than with each instance of the type.
  3917. .P
  3918. The 
  3919. .Cf DW_AT_use_location
  3920. expression, however, cannot be used on its own, but must
  3921. be used in conjunction with the location expressions for
  3922. a particular object of the given pointer to member type
  3923. and for a particular structure or class instance.  The 
  3924. .Cf DW_AT_use_location
  3925. attribute expects two values to be pushed onto the location expression
  3926. stack before the
  3927. .Cf DW_AT_use_location
  3928. expression is evaluated.  The first value pushed should be
  3929. the value of the pointer to member object itself.
  3930. The second value pushed should be the base address of the entire
  3931. structure or union instance containing the member whose
  3932. address is being calculated.
  3933. .P
  3934. So, for an expression like
  3935. .DS
  3936.     \f(CWobject.*mbr_ptr\fP
  3937. .DE
  3938. where \f(CWmbr_ptr\fP has some pointer to member type,
  3939. a debugger should:
  3940. .AL
  3941. .LI
  3942. Push the value of 
  3943. .Cf mbr_ptr
  3944. onto the location expression stack.
  3945. .LI
  3946. Push the base address of
  3947. .Cf object 
  3948. onto the location expression stack.
  3949. .LI
  3950. Evaluate the 
  3951. .Cf DW_AT_use_location
  3952. expression for the type of 
  3953. .Cf mbr_ptr .
  3954. .LE
  3955. .R
  3956. .H 2 "File Type Entries"
  3957. .I
  3958. Some languages, such as Pascal, provide a first class data type
  3959. to represent files.
  3960. .R
  3961. .P
  3962. .IX Pascal
  3963. .IX file types
  3964. A file type is represented by a debugging information entry
  3965. with the tag
  3966. .Cf DW_TAG_file_type.
  3967. If the file type has a name, the file type entry
  3968. has a 
  3969. .Cf DW_AT_name 
  3970. attribute, whose value is a null-terminated string
  3971. containing the type name as it appears in the source program.
  3972. .P
  3973. The file type entry has a 
  3974. .Cf DW_AT_type
  3975. attribute describing the type
  3976. of the objects contained in the file.
  3977. .P
  3978. The file type entry also has a 
  3979. .Cf DW_AT_byte_size 
  3980. attribute, whose value
  3981. is a constant representing the size in bytes of an instance
  3982. of this file type. 
  3983. .OP
  3984. .H 1 "OTHER DEBUGGING INFORMATION"
  3985. This section describes debugging information that
  3986. is not represented in the form of debugging information
  3987. entries and is not contained within the 
  3988. .Cf .debug_info
  3989. section.
  3990. .H 2 "Accelerated Access"
  3991. .I
  3992. .IX accelerated access
  3993. A debugger frequently needs to find the debugging information for
  3994. a program object defined outside of the compilation unit
  3995. where the debugged program is currently stopped.  Sometimes
  3996. it will know only the name of the object; sometimes only the address.
  3997. To find the debugging information
  3998. associated with a global object by name, using the DWARF debugging information
  3999. entries alone, a debugger would need
  4000. to run through all entries at the highest scope within each
  4001. compilation unit.  For lookup by address, for a subroutine,
  4002. a debugger can use the low and high pc attributes
  4003. of the compilation unit entries to quickly narrow down the search,
  4004. but these attributes only cover 
  4005. the range of addresses for the text associated with a compilation
  4006. unit entry.  To find the debugging information associated with a
  4007. data object, an exhaustive search would be needed.
  4008. Furthermore, any search through debugging information entries for
  4009. different compilation units within a large program
  4010. would potentially require the access of many memory pages,
  4011. probably hurting debugger performance.
  4012. .R
  4013. .P
  4014. To make lookups of program objects by name or by address faster,
  4015. a producer of DWARF information may provide two different types
  4016. of tables containing information about the debugging information
  4017. entries owned by a particular compilation unit entry in a more condensed
  4018. format.
  4019. .H 3 "Lookup by Name"
  4020. .IX lookup, by name
  4021. For lookup by name, a table is maintained in a separate
  4022. object file section called
  4023. .Cf .debug_pubnames .
  4024. .IX \f(CW.debug_pubnames\fP %debugap
  4025. The table consists of sets of variable length entries, each
  4026. set describing the names of global objects whose definitions
  4027. or declarations are represented by debugging information entries
  4028. owned by a single compilation unit.  Each set begins
  4029. with a header containing four values: the total length of the entries
  4030. for that set, not including the length field itself, a version number,
  4031. the offset from the beginning of the
  4032. .Cf .debug_info
  4033. .IX \f(CW.debug_info\fP %debugai
  4034. section of the compilation unit entry referenced by the set and
  4035. the size in bytes of the contents of the
  4036. .Cf .debug_info
  4037. section generated to represent that compilation unit. This
  4038. header is followed by a variable number of offset/name pairs.
  4039. Each pair consists of the offset from the beginning of the compilation
  4040. unit entry corresponding to the current set to the 
  4041. debugging information entry for
  4042. the given object, followed by a null-terminated character
  4043. string representing the name of the object as given by
  4044. the
  4045. .Cf DW_AT_name
  4046. attribute of the referenced debugging entry.
  4047. Each set of names is terminated by zero.
  4048. .P
  4049. .IX C++ %caa
  4050. .IX members, static data
  4051. In the case of the name of a static data member or function member
  4052. of a C++ structure, class or union, the name presented
  4053. in the 
  4054. .Cf .debug_pubnames
  4055. section is not the simple name given by the
  4056. .Cf DW_AT_name 
  4057. attribute of the referenced debugging entry, but rather
  4058. the fully class qualified name of the data or function member.
  4059. .IX identifiers, names
  4060. .H 3 "Lookup by Address"
  4061. .IX lookup, by address
  4062. For lookup by address, a table is maintained in a separate
  4063. object file section called
  4064. .Cf .debug_aranges .
  4065. .IX \f(CW.debug_aranges\fP %debugaar
  4066. The table consists of sets of variable length entries, each
  4067. set describing the portion of the program's address space that
  4068. is covered by a single compilation unit.  Each set begins
  4069. with a header containing five values: 
  4070. .AL
  4071. .LI
  4072. The total length of the entries
  4073. for that set, not including the length field itself.
  4074. .LI
  4075. A version number.
  4076. .LI
  4077. The offset from the beginning of the
  4078. .Cf .debug_info
  4079. .IX \f(CW.debug_info\fP %debugai
  4080. section of the compilation unit entry referenced by the set. 
  4081. .LI
  4082. The size in bytes of an address on the target architecture.  For
  4083. segmented addressing, this is the size of the offset portion of the
  4084. .IX addresses, offset portion
  4085. .IX addresses, size of
  4086. address.
  4087. .LI
  4088. .IX address space, segmented
  4089. .IX segmented address space
  4090. The size in bytes of a segment descriptor on the target architecture.
  4091. If the target system uses a flat address space, this value is 0.
  4092. .LE
  4093. .P
  4094. This
  4095. header is followed by a variable number of address
  4096. range descriptors.  Each descriptor is a pair consisting of 
  4097. the beginning address
  4098. of a range of text or data covered by some entry owned
  4099. by the corresponding compilation unit entry, followed by the length
  4100. of that range.  A particular set is terminated by an entry consisting
  4101. of two zeroes.  By scanning the table, a debugger can quickly
  4102. decide which compilation unit to look in to find the debugging information
  4103. for an object that has a given address.
  4104. .H 2 "Line Number Information"
  4105. .I
  4106. .IX line number information
  4107. A source-level debugger will need to know how to associate statements in
  4108. the source files with the corresponding machine instruction addresses in
  4109. the executable object or the shared objects used by that executable
  4110. object.  Such an association would make it possible for the debugger user
  4111. to specify machine instruction addresses in terms of source statements.
  4112. This would be done by specifying the line number and the source file
  4113. containing the statement.  The debugger can also use this information to
  4114. display locations in terms of the source files and to single step from
  4115. statement to statement.
  4116. .R
  4117. .P
  4118. As mentioned in section 3.1, above, 
  4119. the line number information generated for a compilation unit
  4120. is represented in the \f(CW.debug_line\fP section of an object file and is
  4121. referenced by a corresponding compilation unit debugging information entry
  4122. in the \f(CW.debug_info\fP section.
  4123. .IX \f(CW.debug_info\fP %debugai
  4124. .IX \f(CW.debug_line\fP %debugali
  4125. .I
  4126. .P
  4127. If space were not a consideration, the information
  4128. provided in the 
  4129. .Cf .debug_line
  4130. section could be represented as a large matrix,
  4131. with one row for each instruction in the emitted
  4132. object code.  The matrix would have columns for:
  4133. .DL
  4134. .LI
  4135. the source file name
  4136. .LI
  4137. the source line number
  4138. .LI
  4139. the source column number
  4140. .LI
  4141. whether this instruction is the beginning of a source statement
  4142. .LI
  4143. whether this instruction is the beginning of a basic block.
  4144. .LE
  4145. .P
  4146. Such a matrix, however, would be impractically large.  We shrink it with
  4147. two techniques.  First, we delete from the matrix each row whose file,
  4148. line and source column information is identical with that of its predecessors.
  4149. Second, we design a byte-coded language for a state machine and store a stream
  4150. of bytes in the object file instead of the matrix.  This language can be
  4151. much more compact than the matrix.  When a consumer of the statement
  4152. information executes, it must ``run'' the state machine to generate
  4153. the matrix for each compilation unit it is interested in.  The concept
  4154. of an encoded matrix also leaves room for expansion.  In the future,
  4155. columns can be added to the matrix to encode other things that are
  4156. related to individual instruction addresses.
  4157. .R
  4158. .H 3 "Definitions"
  4159. .IX line number information, definitions
  4160. The following terms are used in the description of the line number information
  4161. format:
  4162. .VL 20
  4163. .LI "state machine"
  4164. The hypothetical machine used by a consumer of the line number information 
  4165. to expand the byte-coded instruction stream into a 
  4166. matrix of line number information.
  4167. .LI "statement program"
  4168. A series of byte-coded line number information instructions representing one
  4169. compilation unit.
  4170. .LI "basic block"
  4171. A sequence of instructions that is entered only at the first instruction
  4172. and exited only at the last instruction.  We define a procedure invocation
  4173. to be an exit from a basic block.
  4174. .LI "sequence"
  4175. A series of contiguous target machine instructions.  One compilation
  4176. unit may emit multiple sequences (that is, not all instructions within
  4177. a compilation unit are assumed to be contiguous).
  4178. .LI "sbyte"
  4179. Small signed integer.
  4180. .LI "ubyte"
  4181. Small unsigned integer.
  4182. .LI "uhalf"
  4183. Medium unsigned integer.
  4184. .LI "sword"
  4185. Large signed integer.
  4186. .LI "uword"
  4187. Large unsigned integer.
  4188. .LI "LEB128"
  4189. .IX LEB128
  4190. Variable length signed and unsigned data.  See section 7.6.
  4191. .LE
  4192. .H 3 "State Machine Registers"
  4193. .IX line number information, state machine registers
  4194. The statement information state machine has the following registers:
  4195. .VL 20
  4196. .LI "\f(CWaddress\fP"
  4197. The program-counter value corresponding to a machine instruction generated
  4198. by the compiler.
  4199. .LI "\f(CWfile\fP"
  4200. An unsigned integer indicating the identity of the source file corresponding
  4201. to a machine instruction.
  4202. .IX source, files
  4203. .LI "\f(CWline\fP"
  4204. .IX source, lines
  4205. An unsigned integer indicating a source line number.  Lines are numbered
  4206. beginning at 1.  The compiler may emit the value 0 in cases where an
  4207. instruction cannot be attributed to any source line.
  4208. .LI "\f(CWcolumn\fP"
  4209. .IX source, columns
  4210. An unsigned integer indicating a column number within a source line.
  4211. Columns are numbered beginning at 1.  The value 0 is reserved to indicate
  4212. that a statement begins at the ``left edge'' of the line.
  4213. .LI "\f(CWis_stmt\fP"
  4214. A boolean indicating that the current instruction is the beginning of a
  4215. statement.
  4216. .LI "\f(CWbasic_block\fP"
  4217. A boolean indicating that the current instruction is the beginning of
  4218. a basic block.
  4219. .LI "\f(CWend_sequence\fP"
  4220. A boolean indicating that the current address is that of the first
  4221. byte after the end of a sequence of target machine instructions.
  4222. .LE
  4223. .P
  4224. At the beginning of each sequence within a statement program, the
  4225. state of the registers is:
  4226. .DS
  4227. .TS
  4228. ;
  4229. lf(CW) l.
  4230. address    0
  4231. file    1
  4232. line    1
  4233. column    0
  4234. is_stmt    determined by \f(CWdefault_is_stmt\fP in the statement program prologue
  4235. basic_block    ``false''
  4236. end_sequence    ``false''
  4237. .TE
  4238. .DE
  4239. .H 3 "Statement Program Instructions"
  4240. The state machine instructions in a statement program belong to one
  4241. of three categories:
  4242. .VL 20
  4243. .LI "special opcodes"
  4244. .IX line number information, special opcodes
  4245. These have a ubyte opcode field and no arguments. 
  4246. Most of the instructions in a statement program are special opcodes.
  4247. .LI "standard opcodes"
  4248. .IX line number information, standard opcodes
  4249. These have a ubyte opcode field which may be followed by zero or more
  4250. LEB128 arguments (except for 
  4251. .Cf DW_LNS_fixed_advance_pc ,
  4252. see below).
  4253. The opcode implies the number of arguments and their 
  4254. meanings, but the statement program prologue also specifies the number 
  4255. of arguments for each standard opcode.
  4256. .LI "extended opcodes"
  4257. .IX line number information, extended opcodes
  4258. These have a multiple byte format.  The first byte is zero;
  4259. the next bytes are an unsigned LEB128 integer giving the number of bytes
  4260. in the instruction itself (does not include the first zero byte or the size).
  4261. The remaining bytes are the instruction itself.
  4262. .LE
  4263. .H 3 "The Statement Program Prologue"
  4264. .IX line number information, prologue
  4265. The optimal encoding of line number information depends to a certain
  4266. degree upon the architecture of the target machine.  The statement program
  4267. prologue provides information used by consumers in decoding the statement
  4268. program instructions for a particular compilation unit and also provides
  4269. information used throughout the rest of the statement program.  The statement
  4270. program for each compilation unit begins with a prologue containing the
  4271. following fields in order:
  4272. .AL
  4273. .LI
  4274. .Cf total_length 
  4275. (uword)
  4276. .br
  4277. The size in bytes of the statement information for this compilation unit
  4278. (not including the 
  4279. .Cf total_length
  4280. field itself).
  4281. .LI
  4282. .Cf version
  4283. (uhalf)
  4284. .br
  4285. Version identifier for the statement information format.
  4286. .LI
  4287. .Cf prologue_length 
  4288. (uword)
  4289. .br
  4290. The number of bytes following the 
  4291. .Cf prologue_length
  4292. field to the beginning of the first byte of the statement program itself.
  4293. .LI
  4294. .Cf minimum_instruction_length
  4295. (ubyte)
  4296. .br
  4297. The size in bytes of the smallest target machine instruction.  Statement
  4298. program opcodes that alter the 
  4299. .Cf address 
  4300. register first multiply their operands by this value.
  4301. .LI
  4302. .Cf default_is_stmt
  4303. (ubyte)
  4304. .br
  4305. The initial value of the 
  4306. .Cf is_stmt
  4307. register.  
  4308. .P
  4309. .I
  4310. A simple code generator
  4311. that emits machine instructions in the order implied by the source program
  4312. would set this to ``true,'' and every entry in the matrix would represent
  4313. a statement boundary.  A pipeline scheduling code generator would set
  4314. this to ``false'' and emit a specific statement program opcode for each
  4315. instruction that represented a statement boundary.
  4316. .R
  4317. .LI
  4318. .Cf line_base 
  4319. (sbyte)
  4320. .br
  4321. This parameter affects the meaning of the special opcodes.  See below.
  4322. .LI
  4323. .Cf line_range 
  4324. (ubyte)
  4325. .br
  4326. This parameter affects the meaning of the special opcodes.  See below.
  4327. .LI
  4328. .Cf opcode_base
  4329. (ubyte)
  4330. .br
  4331. The number assigned to the first special opcode.
  4332. .LI
  4333. .Cf standard_opcode_lengths
  4334. (array of ubyte)
  4335. .br
  4336. This array specifies the number of LEB128 operands for each of
  4337. the standard opcodes.  The first element of the array corresponds
  4338. to the opcode whose value is 1, and the last element corresponds
  4339. to the opcode whose value is 
  4340. .Cf "opcode_base - 1" . 
  4341. By increasing
  4342. .Cf opcode_base , 
  4343. and adding elements to this array, new standard opcodes
  4344. can be added, while allowing consumers who do not know about these
  4345. new opcodes to be able to skip them.
  4346. .LI
  4347. .Cf include_directories
  4348. (sequence of path names)
  4349. .br
  4350. The sequence contains an entry for each path that was searched
  4351. for included source files in this compilation.  (The paths include
  4352. those directories specified explicitly by the user for the compiler
  4353. to search and those the compiler searches without explicit direction).
  4354. Each path entry is either a full
  4355. path name or is relative to the current directory of the compilation.
  4356. The current directory of the compilation is understood to be the first entry
  4357. and is not explicitly represented.  
  4358. Each entry is a null-terminated
  4359. string containing a full path name.  The last entry is followed by
  4360. a single null byte.
  4361. .LI
  4362. .Cf file_names
  4363. (sequence of file entries)
  4364. .br
  4365. .IX source, files
  4366. The sequence contains an entry for each source file that contributed
  4367. to the statement information for this compilation unit or is
  4368. used in other contexts, such as in a declaration coordinate
  4369. or a macro file inclusion.  Each entry
  4370. has a null-terminated string containing the file name, 
  4371. an unsigned LEB128 number representing the directory index of the
  4372. directory in which the file was found, 
  4373. an unsigned LEB128 number representing the time of last modification for
  4374. the file and an unsigned LEB128 number representing the length in
  4375. bytes of the file.  A compiler may choose to emit LEB128(0) for the
  4376. time and length fields to indicate that this information is not
  4377. available.  The last entry is followed by a single null byte.
  4378. .P
  4379. The directory index represents an entry in the
  4380. .Cf include_directories
  4381. section.  The index is LEB128(0) if the file was found in
  4382. the current directory of the compilation, LEB128(1) if it was
  4383. found in the first directory in the
  4384. .Cf include_directories
  4385. section, and so on.  The directory index is ignored for file names
  4386. that represent full path names.
  4387. .P
  4388. The statement program assigns numbers to each of the file entries
  4389. in order, beginning with 1, and uses those numbers instead of file
  4390. names in the 
  4391. .Cf file 
  4392. register.
  4393. .P
  4394. A compiler may generate a single null byte for the file names field
  4395. and define file names using the extended opcode
  4396. .Cf DEFINE_FILE .
  4397. .LE
  4398. .H 3 "The Statement Program"
  4399. As stated before, the goal of a statement program is to build a 
  4400. matrix representing
  4401. one compilation unit, which may have produced multiple sequences of
  4402. target-machine instructions. Within a sequence, addresses may only increase.
  4403. (Line numbers may decrease in cases of pipeline scheduling.)
  4404. .H 4 "Special Opcodes"
  4405. .IX line number information, special opcodes
  4406. Each 1-byte special opcode has the following effect on the state machine:
  4407. .AL
  4408. .LI
  4409. Add a signed integer to the 
  4410. .Cf line 
  4411. register.
  4412. .LI
  4413. Multiply an unsigned integer by the 
  4414. .Cf minimum_instruction_length
  4415. field of the statement program prologue and 
  4416. add the result to the 
  4417. .Cf address 
  4418. register.
  4419. .LI
  4420. Append a row to the matrix using the current values of the state machine
  4421. registers.
  4422. .LI
  4423. Set the 
  4424. .Cf basic_block 
  4425. register to ``false.''
  4426. .LE
  4427. .P
  4428. All of the special opcodes do those same four things; 
  4429. they differ from one another
  4430. only in what values they add to the 
  4431. .Cf line 
  4432. and 
  4433. .Cf address 
  4434. registers.
  4435. .P
  4436. .I
  4437. Instead of assigning a fixed meaning to each special opcode, the statement
  4438. program uses several
  4439. parameters in the prologue to configure the instruction set. There are two
  4440. reasons for this.
  4441. First, although the opcode space available for special opcodes now
  4442. ranges from 10 through 255, the lower bound may increase if one adds new
  4443. standard opcodes. Thus, the 
  4444. .Cf opcode_base
  4445. field of the statement program
  4446. prologue gives the value of the first special opcode.
  4447. Second, the best choice of special-opcode meanings depends on the target
  4448. architecture.  For example, for a RISC machine where the compiler-generated code
  4449. interleaves instructions from different lines to schedule the pipeline,
  4450. it is important to be able to add a negative value to the 
  4451. .Cf line 
  4452. register
  4453. to express the fact that a later instruction may have been emitted for an
  4454. earlier source line.  For a machine where pipeline scheduling never occurs,
  4455. it is advantageous to trade away the ability to decrease the 
  4456. .Cf line 
  4457. register
  4458. (a standard opcode provides an alternate way to decrease the line number) in
  4459. return for the ability to add larger positive values to the 
  4460. .Cf address
  4461. register.  To permit this variety of strategies, the statement program prologue 
  4462. defines a 
  4463. .Cf line_base
  4464. field that specifies the minimum value which a special opcode can add
  4465. to the 
  4466. .Cf line
  4467. register and a 
  4468. .Cf line_range
  4469. field that defines the range of
  4470. values it can add to the 
  4471. .Cf line 
  4472. register.
  4473. .R
  4474. .P
  4475. A special opcode value is chosen based on the amount that needs to
  4476. be added to the 
  4477. .Cf line
  4478. and 
  4479. .Cf address
  4480. registers.  The maximum line increment
  4481. for a special opcode is the value of the 
  4482. .Cf line_base
  4483. field in the
  4484. prologue, plus the value of the 
  4485. .Cf line_range 
  4486. field, minus 1 
  4487. (\f(CWline base + line range - 1\fP).  If the desired line increment
  4488. is greater than the maximum line increment, a standard opcode
  4489. must be used instead of a special opcode.
  4490. The ``address advance'' is calculated by dividing the desired address
  4491. increment by the 
  4492. .Cf minimum_instruction_length
  4493. field from the
  4494. prologue.  The special opcode is then calculated using the following
  4495. formula:
  4496. .br
  4497.         \f(CWopcode = (desired line increment - line_base) +
  4498. .br
  4499.                 (line_range * address advance) + opcode_base\fP
  4500. .br
  4501. If the resulting opcode is greater than 255, a standard opcode
  4502. must be used instead.
  4503. .P
  4504. To decode a special opcode, subtract the 
  4505. .Cf opcode_base
  4506. from
  4507. the opcode itself.  The amount to increment the 
  4508. .Cf address 
  4509. register is
  4510. the adjusted opcode divided by the 
  4511. .Cf line_range .
  4512. The amount to
  4513. increment the 
  4514. .Cf line 
  4515. register is the 
  4516. .Cf line_base
  4517. plus the result
  4518. of the adjusted opcode modulo the 
  4519. .Cf line_range .
  4520. That is,
  4521. .br
  4522.     \f(CWline increment = line_base + (adjusted opcode % line_range)\fP
  4523. .br
  4524. .P
  4525. .I
  4526. As an example, suppose that the 
  4527. .Cf opcode_base 
  4528. is 16, 
  4529. .Cf line_base
  4530. is -1 and 
  4531. .Cf line_range
  4532. is 4.
  4533. This means that we can use a special opcode whenever two successive
  4534. rows in the matrix have source line numbers differing by any value within
  4535. the range [-1, 2] (and, because of the limited number of opcodes available,
  4536. when the difference between addresses is within the range [0, 59]).
  4537. .P
  4538. The opcode mapping would be:
  4539. .R
  4540. .DS
  4541. .TS
  4542. box center;
  4543. l l l
  4544. nf(CW) nf(CW) nf(CW)
  4545. .
  4546. Opcode    Line advance    Address advance
  4547. _
  4548. 16    -1    0
  4549. 17    0    0
  4550. 18    1    0
  4551. 19    2    0
  4552. 20    -1    1
  4553. 21    0    1
  4554. 22    1    1
  4555. 23    2    1
  4556. ...    ...    ...
  4557. 253    0    59
  4558. 254    1    59
  4559. 255    2    59
  4560. .TE
  4561. .DE
  4562. .P
  4563. There is no requirement that the expression \f(CW255 - line_base + 1\fP be an
  4564. integral multiple of 
  4565. .Cf line_range .
  4566. .H 4 "Standard Opcodes"
  4567. .IX line number information, standard opcodes
  4568. There are currently 9 standard ubyte opcodes.  In the future 
  4569. additional ubyte opcodes may be defined by setting the 
  4570. .Cf opcode_base
  4571. field in the statement program
  4572. prologue to a value greater than 10.
  4573. .AL
  4574. .LI
  4575. .Cf DW_LNS_copy 
  4576. .br
  4577. Takes no arguments.  Append a row to the matrix using the current values of
  4578. the state-machine registers.  Then set the 
  4579. .Cf basic_block
  4580. register to ``false.''
  4581. .LI
  4582. .Cf DW_LNS_advance_pc
  4583. .br
  4584. Takes a single unsigned LEB128 operand,
  4585. multiplies it by the
  4586. .Cf minimum_instruction_length
  4587. field of the prologue, and adds the result to the
  4588. .Cf address
  4589. register of the state machine.
  4590. .LI
  4591. .Cf DW_LNS_advance_line
  4592. .br
  4593. Takes a single signed LEB128 operand and adds
  4594. that value to the 
  4595. .Cf line
  4596. register of the state machine.
  4597. .LI
  4598. .Cf DW_LNS_set_file 
  4599. .br
  4600. Takes a single unsigned LEB128 operand and stores
  4601. it in the 
  4602. .Cf file
  4603. register of the state machine.
  4604. .LI
  4605. .Cf DW_LNS_set_column
  4606. .br
  4607. Takes a single unsigned LEB128 operand and stores
  4608. it in the 
  4609. .Cf column 
  4610. register of the state machine.
  4611. .LI
  4612. .Cf DW_LNS_negate_stmt
  4613. .br
  4614. Takes no arguments.
  4615. Set the 
  4616. .Cf is_stmt
  4617. register of the state machine to the
  4618. logical negation of its current value.
  4619. .LI
  4620. .Cf DW_LNS_set_basic_block
  4621. .br
  4622. Takes no arguments.  Set the 
  4623. .Cf basic_block 
  4624. register of the state machine to ``true.''
  4625. .LI
  4626. .Cf DW_LNS_const_add_pc
  4627. .br
  4628. Takes no arguments.
  4629. Add to the 
  4630. .Cf address 
  4631. register of the state machine the
  4632. address increment value corresponding to special
  4633. opcode 255.
  4634. .P
  4635. .I
  4636. The motivation for 
  4637. .Cf DW_LNS_const_add_pc 
  4638. is this:  when the statement program needs
  4639. to advance the address by a small amount, it can use a single special
  4640. opcode, which occupies a single byte.  When it needs to advance the
  4641. address by up to twice the range of the last special opcode, it can use
  4642. .Cf DW_LNS_const_add_pc 
  4643. followed by a special opcode, for a total of two bytes.
  4644. Only if it needs to advance the address by more than twice that range
  4645. will it need to use both
  4646. .Cf DW_LNS_advance_pc
  4647. and a special opcode, requiring three or more bytes.
  4648. .R
  4649. .LI
  4650. .Cf DW_LNS_fixed_advance_pc
  4651. .br
  4652. Takes a single uhalf operand.  Add to the 
  4653. .Cf address 
  4654. register of the state machine the value of the (unencoded) operand.
  4655. This is the only extended opcode that takes an argument that is not
  4656. a variable length number.
  4657. .P
  4658. .I
  4659. The motivation for 
  4660. .Cf DW_LNS_fixed_advance_pc
  4661. is this:  existing assemblers cannot emit 
  4662. .Cf DW_LNS_advance_pc
  4663. or special opcodes because they cannot encode LEB128 numbers
  4664. or judge when the computation of a special opcode overflows and requires
  4665. the use of 
  4666. .Cf DW_LNS_advance_pc .
  4667. Such assemblers, however,  can use
  4668. .Cf DW_LNS_fixed_advance_pc
  4669. instead, sacrificing compression. 
  4670. .R
  4671. .LE
  4672. .H 4 "Extended Opcodes"
  4673. .IX line number information, extended opcodes
  4674. There are three extended opcodes currently defined.  The first byte
  4675. following the length field of the encoding for each contains a sub-opcode.
  4676. .AL
  4677. .LI
  4678. \f(CWDW_LNE_end_sequence\fP 
  4679. .br
  4680. Set the 
  4681. .Cf end_sequence 
  4682. register of the state machine
  4683. to ``true'' and append a row to the matrix using the
  4684. current values of the state-machine registers.  Then
  4685. reset the registers to the initial values specified
  4686. above.
  4687. .P
  4688. Every statement program sequence must end with a
  4689. .Cf DW_LNE_end_sequence
  4690. instruction which creates a
  4691. row whose address is that of the byte after the last target machine instruction
  4692. of the sequence.
  4693. .LI
  4694. \f(CWDW_LNE_set_address\fP
  4695. .br
  4696. Takes a single relocatable address as an operand.  The size of the
  4697. operand is the size appropriate to hold an address on the target machine.
  4698. Set the 
  4699. .Cf address 
  4700. register to the value given by the
  4701. relocatable address. 
  4702. .P
  4703. .I
  4704. All of the other statement program opcodes that affect the 
  4705. .Cf address 
  4706. register add a delta to it. 
  4707. This instruction stores a relocatable value into it instead.
  4708. .R
  4709. .LI
  4710. \f(CWDW_LNE_define_file\fP
  4711. .br
  4712. .IX source, files
  4713. Takes 4 arguments.  The first is a null terminated string containing a
  4714. source file name.  The second is an
  4715. unsigned LEB128 number representing the directory index of the
  4716. directory in which the file was found.
  4717. The third is an unsigned LEB128 number representing
  4718. the time of last modification of the file.  The fourth is an unsigned
  4719. LEB128 number representing the length in bytes of the file.
  4720. The time and length fields may contain LEB128(0) if the information is
  4721. not available.
  4722. .P
  4723. The directory index represents an entry in the
  4724. .Cf include_directories
  4725. section of the statement program prologue.  
  4726. The index is LEB128(0) if the file was found in
  4727. the current directory of the compilation, LEB128(1) if it was
  4728. found in the first directory in the
  4729. .Cf include_directories
  4730. section, and so on.  The directory index is ignored for file names
  4731. that represent full path names.
  4732. .P
  4733. The files are numbered, starting at 1,
  4734. in the order in which they appear; the names in the prologue
  4735. come before names defined by the
  4736. .Cf DW_LNE_define_file
  4737. instruction.
  4738. These numbers are used in the the 
  4739. .Cf file 
  4740. register of the state machine.
  4741. .LE
  4742. .P
  4743. .I
  4744. Appendix 3 gives some sample statement programs.
  4745. .R
  4746. .H 2 "Macro Information"
  4747. .I
  4748. .IX macro information
  4749. .IX pre-processor
  4750. .IX C %c
  4751. .IX C++ %caa
  4752. Some languages, such as C and C++, provide a way to replace text
  4753. in the source program with macros defined either in the source
  4754. file itself, or in another file included by the source file.
  4755. Because these macros are not themselves defined in the target
  4756. language, it is difficult to represent their definitions
  4757. using the standard language constructs of DWARF.  The debugging
  4758. information therefore reflects the state of the source after
  4759. the macro definition has been expanded, rather than as the
  4760. programmer wrote it.
  4761. The macro information table provides a way of preserving the original
  4762. source in the debugging information.
  4763. .R
  4764. .P
  4765. As described in section 3.1, the macro information for a given
  4766. compilation unit is represented in the
  4767. .Cf .debug_macinfo
  4768. .IX \f(CW.debug_macinfo\fP %debugam
  4769. section of an object file.  The macro information for each compilation
  4770. unit is represented as a series of ``macinfo'' entries.  Each
  4771. macinfo entry consists of a ``type code'' and up to two additional
  4772. operands.  The series of entries for a given compilation unit
  4773. ends with an entry containing a type code of 0.
  4774. .H 3 "Macinfo Types"
  4775. The valid macinfo types are as follows:
  4776. .VL 30
  4777. .LI \f(CWDW_MACINFO_define\fP
  4778. A macro definition.
  4779. .LI \f(CWDW_MACINFO_undef\fP
  4780. A macro un-definition.
  4781. .LI \f(CWDW_MACINFO_start_file\fP
  4782. The start of a new source file inclusion.
  4783. .LI \f(CWDW_MACINFO_end_file\fP
  4784. The end of the current source file inclusion.
  4785. .LI \f(CWDW_MACINFO_vendor_ext\fP
  4786. Vendor specific macro information directives that do not fit
  4787. into one of the standard categories.
  4788. .LE
  4789. .H 4 "Define and Undefine Entries"
  4790. .IX macro information, define and undefine entries
  4791. All 
  4792. .Cf DW_MACINFO_define
  4793. and 
  4794. .Cf DW_MACINFO_undef
  4795. entries have two operands.
  4796. The first operand encodes the line number of the source line
  4797. .IX source, lines
  4798. on which the relevant defining or undefining
  4799. pre-processor directives appeared.
  4800. .P 
  4801. The second operand consists of a null-terminated character string.
  4802. In the case of a 
  4803. .Cf DW_MACINFO_undef 
  4804. entry, the value of this
  4805. string will be simply the name of the pre-processor
  4806. symbol which was undefined at the indicated source line.
  4807. .P
  4808. In the case of a 
  4809. .Cf DW_MACINFO_define
  4810. entry, the value of this
  4811. string will be the name of the pre-processor symbol
  4812. that was defined at the indicated source line,
  4813. followed immediately by the macro formal parameter
  4814. list including the surrounding parentheses (in the
  4815. case of a function-like macro) followed by the
  4816. definition string for the macro.  If there is no
  4817. formal parameter list, then the name of the defined
  4818. macro is followed directly by its definition string.
  4819. .P
  4820. In the case of a function-like macro definition, no
  4821. whitespace characters should appear between the
  4822. name of the defined macro and the following left
  4823. parenthesis.  Also, no whitespace characters should
  4824. appear between successive formal parameters in the
  4825. formal parameter list.  (Successive formal parameters
  4826. should, however, be separated by commas.)  Also, exactly
  4827. one space character
  4828. should separate the right parenthesis which terminates
  4829. the formal parameter list and the following definition
  4830. string.
  4831. .P
  4832. In the case of a ``normal'' (i.e. non-function-like)
  4833. macro definition, exactly one space character
  4834. should separate the name of the defined macro from the following definition
  4835. text.
  4836. .H 4 "Start File Entries"
  4837. .IX macro information, start file entries
  4838. Each 
  4839. .Cf DW_MACINFO_start_file
  4840. entry also has two operands.  The first operand
  4841. encodes the line number of the
  4842. source line on which the inclusion pre-processor
  4843. directive occurred.
  4844. .P
  4845. .IX source, files
  4846. The second operand encodes a
  4847. source file name index.  This index corresponds to a file
  4848. number in the statement information table for the relevant
  4849. compilation unit.  This index
  4850. indicates (indirectly) the name of the file
  4851. which is being included by the inclusion directive on
  4852. the indicated source line.
  4853. .H 4 "End File Entries"
  4854. .IX macro information, end file entries
  4855. .Cf DW_MACINFO_end_file 
  4856. entry has no operands.  The presence of the entry marks the end of
  4857. the current source file inclusion.
  4858. .H 4 "Vendor Extension Entries"
  4859. .IX macro information, vendor extensions
  4860. .IX vendor extensions
  4861. A
  4862. .Cf DW_MACINFO_vendor_ext
  4863. entry has two operands.
  4864. The first is a constant.  The second is a null-terminated
  4865. character string.
  4866. The meaning and/or significance of these operands is
  4867. intentionally left undefined by this specification.
  4868. .P
  4869. A consumer must be able to totally ignore all
  4870. .Cf DW_MACINFO_vendor_ext
  4871. entries that it does not understand.
  4872. .H 3 "Base Source Entries"
  4873. .IX macro information, base source entries
  4874. In addition to producing a matched pair of
  4875. .Cf DW_MACINFO_start_file 
  4876. and 
  4877. .Cf DW_MACINFO_end_file
  4878. entries for 
  4879. each inclusion directive actually processed during
  4880. compilation, a producer should generate such a matched
  4881. pair also for the ``base'' source file submitted to the
  4882. compiler for compilation.  If the base source file
  4883. .IX source, files
  4884. for a compilation is submitted to the compiler via
  4885. some means other than via a named disk file (e.g. via
  4886. the standard input \fIstream\fP on a UNIX system) then the
  4887. compiler should still produce this matched pair of
  4888. .Cf DW_MACINFO_start_file
  4889. and 
  4890. .Cf DW_MACINFO_end_file 
  4891. entries for
  4892. the base source file, however, the file name indicated
  4893. (indirectly) by the 
  4894. .Cf DW_MACINFO_start_file
  4895. entry of the
  4896. pair should reference a statement information file name entry consisting
  4897. of a null string.
  4898. .H 3 "Macinfo Entries for Command Line Options"
  4899. .IX macro information, command line options
  4900. In addition to producing
  4901. .Cf DW_MACINFO_define 
  4902. and
  4903. .Cf DW_MACINFO_undef
  4904. entries for each of the define and
  4905. undefine directives processed during compilation, the
  4906. DWARF producer should generate a 
  4907. .Cf DW_MACINFO_define 
  4908. or
  4909. .Cf DW_MACINFO_undef
  4910. entry for each pre-processor symbol
  4911. which is defined or undefined by some
  4912. means other than via a define or undefine directive
  4913. within the compiled source text.  In particular,
  4914. pre-processor symbol definitions and un-definitions
  4915. which occur as a result of command line options
  4916. (when invoking the compiler) should be represented by
  4917. their own 
  4918. .Cf DW_MACINFO_define
  4919. and 
  4920. .Cf DW_MACINFO_undef
  4921. entries.
  4922. .P
  4923. All such 
  4924. .Cf DW_MACINFO_define
  4925. and 
  4926. .Cf DW_MACINFO_undef
  4927. entries representing compilation options should appear 
  4928. before the first 
  4929. .Cf DW_MACINFO_start_file
  4930. entry for that compilation unit and should encode the value
  4931. 0 in their line number operands.
  4932. .H 3 " General Rules and Restrictions"
  4933. .IX line number information, general rules
  4934. All macinfo entries within a 
  4935. .Cf .debug_macinfo 
  4936. section for a given compilation unit should appear in the same order
  4937. in which the directives were processed by the compiler.
  4938. .P
  4939. All macinfo entries representing command line options
  4940. should appear in the same order as the relevant command
  4941. line options were given to the compiler.  In the case
  4942. where the compiler itself implicitly supplies one or
  4943. more macro definitions or un-definitions in addition
  4944. to those which may be specified on the command line,
  4945. macinfo entries should also be produced for these
  4946. implicit definitions and un-definitions, and
  4947. these entries should also appear in the proper order
  4948. relative to each other and to any definitions or
  4949. undefinitions given explicitly by the user on the
  4950. command line.
  4951. .H 2 "Call Frame Information"
  4952. .IX call frame information
  4953. .IX activations
  4954. .I
  4955. Debuggers often need to be able to view and modify the state of any
  4956. subroutine activation that is on the call stack.  An activation
  4957. consists of:
  4958. .BL
  4959. .LI
  4960. A code location that is within the subroutine.  This location is
  4961. either the place where the program stopped when the debugger got
  4962. control (e.g. a breakpoint), or is a place where a subroutine
  4963. made a call or was interrupted by an asynchronous event (e.g. a
  4964. signal).
  4965. .LI
  4966. An area of memory that is allocated on a stack called a ``call
  4967. frame.''  The call frame is identified by an address on the
  4968. stack.  We refer to this address as the Canonical Frame Address or CFA.
  4969. .LI
  4970. A set of registers that are in use by the subroutine at the code
  4971. location.
  4972. .LE
  4973. .P
  4974. Typically, a set of registers are designated to be preserved across a
  4975. call.  If a callee wishes to use such a register, it saves the value
  4976. that the register had at entry time in its call frame and restores it
  4977. on exit.  The code that allocates space on the call frame stack and
  4978. performs the save operation is called the subroutine's prologue, and the
  4979. code that performs the restore operation and deallocates the frame is
  4980. called its epilogue.  Typically, the prologue code is physically at the
  4981. beginning of a subroutine and the epilogue code is at the end.
  4982. .P
  4983. To be able to view or modify an activation that is not on the top of
  4984. the call frame stack, the debugger must ``virtually unwind'' the stack of
  4985. activations until it finds the activation of interest. 
  4986. A debugger unwinds a
  4987. stack in steps.  Starting with the current activation it restores any
  4988. registers that were preserved by the current activation and computes the
  4989. predecessor's CFA and code location.  This has the logical effect of
  4990. returning from the current subroutine to its predecessor.  We say that
  4991. the debugger virtually unwinds the stack because it preserves enough
  4992. information to be able to ``rewind'' the stack back to the state it was
  4993. in before it attempted to unwind it.
  4994. .P
  4995. The unwinding operation needs to know where registers are saved and how
  4996. to compute the predecessor's CFA and code location.  When considering
  4997. an architecture-independent way of encoding this information one has to
  4998. consider a number of special things.
  4999. .BL
  5000. .LI
  5001. Prologue and epilogue code is not always in distinct blocks at the
  5002. beginning and end of a subroutine.  It is common to duplicate the
  5003. epilogue code at the site of each return from the code.  Sometimes
  5004. a compiler breaks up the register save/unsave operations and moves
  5005. them into the body of the subroutine to just where they are needed.
  5006. .LI
  5007. Compilers use different ways to manage the call frame.  Sometimes
  5008. they use a frame pointer register, sometimes not.
  5009. .LI
  5010. The algorithm to compute the CFA changes as you progress through
  5011. the prologue and epilogue code.  (By definition, the CFA value
  5012. does not change.)
  5013. .LI
  5014. Some subroutines have no call frame.
  5015. .LI
  5016. Sometimes a register is saved in another register that by
  5017. convention does not need to be saved.
  5018. .LI
  5019. Some architectures have special instructions that
  5020. perform some or all of the register management in one instruction,
  5021. leaving special information on the stack that indicates how
  5022. registers are saved.
  5023. .LI
  5024. Some architectures treat return address values
  5025. specially.  For example, in one architecture, 
  5026. the call instruction guarantees that the low order two
  5027. bits will be zero and the return instruction ignores those bits.
  5028. This leaves two bits of storage that are available to other uses
  5029. that must be treated specially.
  5030. .LE
  5031. .R
  5032. .H 3 "Structure of Call Frame Information"
  5033. .IX call frame information, structure
  5034. DWARF supports virtual unwinding by defining an architecture independent
  5035. basis for recording how procedures save and restore registers throughout
  5036. their lifetimes.  This basis must be augmented on some machines with
  5037. specific information that is defined by either an architecture specific
  5038. ABI authoring committee, a hardware vendor, or a compiler producer.
  5039. .IX ABI
  5040. .IX vendor extensions
  5041. The body defining a specific augmentation is referred to
  5042. below as the ``augmenter.''
  5043. .P
  5044. Abstractly, this mechanism describes a very large table that has the
  5045. following structure:
  5046. .TS
  5047. center;
  5048. l l l l l l
  5049. l s s s s s.
  5050. LOC  CFA   R0   R1   ...  RN
  5051. L0
  5052. L1
  5053. \...
  5054. LN
  5055. .TE
  5056. .P
  5057. The first column indicates an address for every location that contains
  5058. code in a program.  (In shared objects, this is an object-relative
  5059. offset.)  The remaining columns contain virtual unwinding rules that are
  5060. associated with the indicated location.  The first column of the rules
  5061. defines the CFA rule which is a register and a signed offset that are
  5062. added together to compute the CFA value.
  5063. .P
  5064. The remaining columns are labeled by register number.  This includes
  5065. some registers that have special designation on some architectures such
  5066. as the PC and the stack pointer register.  (The actual mapping of
  5067. registers for a particular architecture is performed by the augmenter.)
  5068. The register columns contain rules that describe
  5069. whether a given register has been saved and the rule to find 
  5070. the value for the register in the previous frame.
  5071. .P
  5072. The register rules are:
  5073. .IX call frame information, register rules
  5074. .VL 20
  5075. .LI "undefined"
  5076. A register that has this rule has no value in the
  5077. previous frame.  (By convention, it is not preserved by a callee.)
  5078. .LI "same value"
  5079. This register has not been modified from the
  5080. previous frame.  (By convention, it is preserved by the callee,
  5081. but the callee has not modified it.)
  5082. .LI "offset(N)"
  5083. The previous value of this register is saved at the address CFA+N where
  5084. CFA is the current CFA value and N is a signed offset.
  5085. .LI "register(R)"
  5086. The previous value of this register is stored in
  5087. another register numbered R.
  5088. .LI "architectural"
  5089. The rule is defined externally to this specification by the augmenter.
  5090. .LE
  5091. .P
  5092. .I
  5093. This table would be extremely large if actually constructed as
  5094. described.  Most of the entries at any point in the table are identical
  5095. to the ones above them.  The whole table can be represented quite
  5096. compactly by recording just the differences starting at the beginning
  5097. address of each subroutine in the program.
  5098. .R
  5099. .P
  5100. The virtual unwind information is encoded in a self-contained section
  5101. called 
  5102. .Cf .debug_frame . 
  5103. .IX \f(CW.debug_frame\fP %debugaf
  5104. Entries in a 
  5105. .Cf .debug_frame
  5106. section are aligned on
  5107. .IX call frame information, Common Information Entry
  5108. an addressing unit boundary and come in two forms: A Common Information
  5109. Entry (CIE) and a Frame Description Entry (FDE).
  5110. Sizes of data objects used in the encoding of the 
  5111. .Cf .debug_frame
  5112. section are described in terms of the same data definitions
  5113. used for the line number information (see section 6.2.1).
  5114. .P
  5115. A Common Information Entry holds information that is shared among many
  5116. Frame Descriptors.  There is at least one CIE in every non-empty
  5117. .Cf .debug_frame 
  5118. section.  A CIE contains the following fields, in order:
  5119. .AL
  5120. .LI 
  5121. \f(CWlength\fP
  5122. .br
  5123. A uword constant that gives the number of bytes of the CIE
  5124. structure, not including the length field, itself 
  5125. (length mod <addressing unit size> == 0).
  5126. .LI 
  5127. \f(CWCIE_id\fP
  5128. .br
  5129. A uword constant that is used to distinguish CIEs
  5130. from FDEs.
  5131. .LI
  5132. \f(CWversion\fP
  5133. .br
  5134. A ubyte version number.  This number is specific to the call frame
  5135. information and is independent of the DWARF version number.
  5136. .LI 
  5137. \f(CWaugmentation\fP
  5138. .br
  5139. A null terminated string that identifies the
  5140. augmentation to this CIE or to the FDEs that use
  5141. it.  If a reader encounters an augmentation string that is
  5142. unexpected, then only the following fields can be read:
  5143. CIE: 
  5144. .Cf length , 
  5145. .Cf CIE_id , 
  5146. .Cf version , 
  5147. .Cf augmentation ;
  5148. FDE:
  5149. .Cf length , 
  5150. .Cf CIE_pointer , 
  5151. .Cf initial_location , 
  5152. .Cf address_range .
  5153. If there is no augmentation, this value is a zero byte.
  5154. .LI 
  5155. \f(CWcode_alignment_factor\fP
  5156. .br
  5157. An unsigned LEB128 constant that is factored out
  5158. of all advance location instructions (see below).
  5159. .LI 
  5160. \f(CWdata_alignment_factor\fP
  5161. .br
  5162. A signed LEB128 constant that is factored out
  5163. of all offset instructions (see below.)
  5164. .LI 
  5165. \f(CWreturn_address_register\fP
  5166. .br
  5167. A ubyte constant that indicates
  5168. which column in the rule table represents the return address
  5169. of the function.  Note that this column might not correspond
  5170. to an actual machine register.
  5171. .LI 
  5172. \f(CWinitial_instructions\fP
  5173. .br
  5174. A sequence of rules that are interpreted to
  5175. create the initial setting of each column in the table.
  5176. .LI 
  5177. \f(CWpadding\fP
  5178. .br
  5179. Enough 
  5180. .Cf DW_CFA_nop
  5181. instructions to make the size of this entry
  5182. match the 
  5183. .Cf length
  5184. value above.
  5185. .LE
  5186. .P
  5187. An FDE contains the following fields, in order:
  5188. .IX call frame information, Frame Description Entry
  5189. .AL
  5190. .LI 
  5191. \f(CWlength\fP
  5192. .br
  5193. A uword constant that gives the number of bytes of the header
  5194. and instruction stream for this function (not including the length
  5195. field itself) (length mod <addressing unit size> == 0).
  5196. .LI 
  5197. \f(CWCIE_pointer\fP
  5198. .br
  5199. A uword constant offset into the
  5200. .Cf .debug_frame 
  5201. section that denotes the CIE that is associated with this FDE.
  5202. .LI 
  5203. \f(CWinitial_location\fP
  5204. An addressing-unit sized constant indicating
  5205. the address of the first location associated with this table entry.
  5206. .LI 
  5207. \f(CWaddress_range\fP
  5208. .br
  5209. An addressing unit sized constant indicating the
  5210. number of bytes of program instructions described by this entry.
  5211. .LI 
  5212. \f(CWinstructions\fP
  5213. .br
  5214. A sequence of table defining instructions that are
  5215. described below.
  5216. .LE
  5217. .H 3 "Call Frame Instructions"
  5218. .IX call frame information, instructions
  5219. Each call frame instruction is defined to
  5220. take 0 or more operands.  Some of the operands may be
  5221. encoded as part of the opcode (see section 7.23).
  5222. The instructions are as follows:
  5223. .AL
  5224. .LI 
  5225. .Cf DW_CFA_advance_loc
  5226. takes a single argument that represents a constant delta.
  5227. The required action is to
  5228. create a new table row with a location value that
  5229. is computed by taking the current entry's location value and
  5230. adding (delta * \f(CWcode_alignment_factor\fP).  All other values in the
  5231. new row are initially identical to the current row.
  5232. .LI 
  5233. .Cf DW_CFA_offset
  5234. takes two arguments: 
  5235. an unsigned LEB128 constant representing a factored offset
  5236. and a register number.  The required action is
  5237. to change the rule for the register indicated by the register
  5238. number to be an offset(N) rule with a value of
  5239. (N = factored offset * \f(CWdata_alignment_factor\fP).
  5240. .LI 
  5241. .Cf DW_CFA_restore
  5242. takes a single argument that represents a register number.
  5243. The required action is
  5244. to change the rule for the indicated register 
  5245. to the rule assigned it by the \f(CWinitial_instructions\fP in the CIE.
  5246. .LI 
  5247. .Cf DW_CFA_set_loc
  5248. takes a single argument that represents an address.
  5249. The required action is to create a new table row
  5250. using the specified address as the location. 
  5251. All other values in the
  5252. new row are initially identical to the current row.
  5253. The new location value should always be greater than the current
  5254. one.
  5255. .LI 
  5256. .Cf DW_CFA_advance_loc1
  5257. takes a single ubyte argument that represents a constant delta.
  5258. This instruction is identical to 
  5259. .Cf DW_CFA_advance_loc
  5260. except for the encoding and size of the delta argument.
  5261. .LI 
  5262. .Cf DW_CFA_advance_loc2
  5263. takes a single uhalf argument that represents a constant delta.
  5264. This instruction is identical to 
  5265. .Cf DW_CFA_advance_loc
  5266. except for the encoding and size of the delta argument.
  5267. .LI 
  5268. .Cf DW_CFA_advance_loc4
  5269. takes a single uword argument that represents a constant delta.
  5270. This instruction is identical to 
  5271. .Cf DW_CFA_advance_loc
  5272. except for the encoding and size of the delta argument.
  5273. .LI 
  5274. .Cf DW_CFA_offset_extended
  5275. takes two unsigned LEB128 arguments representing a register number
  5276. and a factored offset.
  5277. This instruction is identical to 
  5278. .Cf DW_CFA_offset
  5279. except for the encoding and size of the register argument.
  5280. .LI 
  5281. .Cf DW_CFA_restore_extended
  5282. takes a single unsigned LEB128 argument that represents a register number.
  5283. This instruction is identical to 
  5284. .Cf DW_CFA_restore
  5285. except for the encoding and size of the register argument.
  5286. .LI 
  5287. .Cf DW_CFA_undefined
  5288. takes a single unsigned LEB128 argument that represents a register number.
  5289. The required action is to set the rule for the specified register
  5290. to ``undefined.''
  5291. .LI 
  5292. .Cf DW_CFA_same_value
  5293. takes a single unsigned LEB128 argument that represents a register number.
  5294. The required action is to set the rule for the specified register
  5295. to ``same value.''
  5296. .LI 
  5297. .Cf DW_CFA_register
  5298. takes two unsigned LEB128 arguments representing register numbers.
  5299. The required action is to set the rule for the first register
  5300. to be the second register.
  5301. .LI 
  5302. \f(CWDW_CFA_remember_state\fP
  5303. .LI 
  5304. \f(CWDW_CFA_restore_state\fP
  5305. .br
  5306. These instructions define a stack of information.  Encountering the 
  5307. .Cf DW_CFA_remember_state
  5308. instruction means to save the rules for every register
  5309. on the current row on the stack.  Encountering the
  5310. .Cf DW_CFA_restore_state
  5311. instruction means to pop the set of rules
  5312. off the stack and place them in the current row.  
  5313. .I
  5314. (This
  5315. operation is useful for compilers that move epilogue
  5316. code into the body of a function.)
  5317. .R
  5318. .LI
  5319. .Cf DW_CFA_def_cfa
  5320. takes two unsigned LEB128 arguments representing a
  5321. register number and an offset.
  5322. The required action is to define the current CFA rule
  5323. to use the provided register and offset.
  5324. .LI 
  5325. .Cf DW_CFA_def_cfa_register
  5326. takes a single unsigned LEB128 argument representing a register
  5327. number.  The required action is to define the current CFA
  5328. rule to use the provided register (but to keep the old offset).
  5329. .LI 
  5330. .Cf DW_CFA_def_cfa_offset
  5331. takes a single unsigned LEB128 argument representing an offset.
  5332. The required action is to define the current CFA
  5333. rule to use the provided offset (but to keep the old register).
  5334. .LI 
  5335. .Cf DW_CFA_nop
  5336. has no arguments and no required actions.  It is used as padding
  5337. to make the FDE an appropriate size.
  5338. .LE
  5339. .H 3 "Call Frame Instruction Usage"
  5340. .IX call frame information, usage
  5341. .I
  5342. To determine the virtual unwind rule set for a given location (L1), one
  5343. searches through the FDE headers looking at the 
  5344. .Cf initial_location
  5345. and
  5346. .Cf address_range
  5347. values to see if L1 is contained in the FDE.  If so, then:
  5348. .AL
  5349. .LI
  5350. Initialize a register set by reading the 
  5351. .Cf initial_instructions
  5352. field of the associated CIE.
  5353. .LI
  5354. Read and process the FDE's instruction sequence until a
  5355. .Cf DW_CFA_advance_loc ,
  5356. .Cf DW_CFA_set_loc ,
  5357. or the end of the instruction stream is
  5358. encountered.
  5359. .LI
  5360. If a 
  5361. .Cf DW_CFA_advance_loc
  5362. or 
  5363. .Cf DW_CFA_set_loc
  5364. instruction was encountered, then
  5365. compute a new location value (L2).  If L1 >= L2 then process the
  5366. instruction and go back to step 2.
  5367. .LI
  5368. The end of the instruction stream can be thought of as a
  5369. .br
  5370. \f(CWDW_CFA_set_loc( initial_location + address_range )\fP 
  5371. .br
  5372. instruction.  
  5373. Unless the FDE is ill-formed, L1 should be less than L2 at this point.
  5374. .LE
  5375. .P
  5376. The rules in the register set now apply to location L1.
  5377. .P
  5378. For an example, see Appendix 5.
  5379. .R
  5380. .OP
  5381. .H 1 "DATA REPRESENTATION"
  5382. This section describes the binary representation of the debugging
  5383. information entry itself, of the
  5384. attribute types and of other fundamental elements described above.
  5385. .H 2 "Vendor Extensibility"
  5386. .IX vendor extensions
  5387. To reserve a portion of the DWARF name space and ranges of
  5388. enumeration values for use for vendor specific extensions,
  5389. .IX tags
  5390. .IX types, base
  5391. .IX base types
  5392. .IX locations, expressions
  5393. .IX calling conventions
  5394. .IX call frame information
  5395. special labels are reserved for tag names, attribute names,
  5396. base type encodings, location operations, language names,
  5397. calling conventions and call frame instructions.
  5398. The labels denoting the beginning and end of the reserved value
  5399. range for vendor specific extensions consist of the appropriate prefix (
  5400. .Cf DW_TAG ,
  5401. .Cf DW_AT ,
  5402. .Cf DW_ATE ,
  5403. .Cf DW_OP ,
  5404. .Cf DW_LANG ,
  5405. .CF DW_CC
  5406. or
  5407. .Cf DW_CFA
  5408. respectively) followed by 
  5409. .Cf _lo_user
  5410. or 
  5411. .Cf _hi_user .
  5412. For example, for entry tags, the special labels are
  5413. .Cf DW_TAG_lo_user
  5414. and
  5415. .Cf DW_TAG_hi_user .
  5416. Values in the range between \fIprefix\fP\f(CW_lo_user\fP and
  5417. \fIprefix\fP\f(CW_hi_user\fP
  5418. inclusive, are reserved for vendor specific extensions.
  5419. Vendors may use values in this range without
  5420. conflicting with current or future system-defined values.
  5421. All other values are reserved for use by the system.
  5422. .P
  5423. Vendor defined tags, attributes, base type encodings, location atoms, 
  5424. language names, calling conventions and call frame instructions, 
  5425. conventionally use the form
  5426. \fIprefix\f(CW_\fIvendor_id\f(CW_\fIname\fR, where \fIvendor_id\fP is some 
  5427. identifying character sequence chosen so as to avoid conflicts with other
  5428. vendors.
  5429. .P
  5430. .IX compatibility
  5431. To ensure that extensions added by one vendor may be safely ignored
  5432. by consumers that do not understand those extensions, 
  5433. the following rules should be followed:
  5434. .AL
  5435. .LI
  5436. New attributes should be added in such a way that a debugger may recognize
  5437. the format of a new attribute value without knowing the content of that
  5438. attribute value.
  5439. .LI
  5440. The semantics of any new attributes should not alter the semantics of
  5441. previously existing attributes.
  5442. .LI
  5443. The semantics of any new tags
  5444. should not conflict with the semantics of previously existing tags.
  5445. .LE
  5446. .H 2 "Reserved Error Values"
  5447. .IX error values
  5448. As a convenience for consumers of DWARF information,
  5449. the value 0 is reserved in the encodings for attribute names, attribute
  5450. forms, base type encodings, location operations, languages,
  5451. statement program opcodes, macro information entries and tag names
  5452. to represent an error condition or unknown value.  DWARF does
  5453. not specify names for these reserved values, since they do not
  5454. represent valid encodings for the given type and should not appear
  5455. in DWARF debugging information.
  5456. .H 2 "Executable Objects and Shared Objects"
  5457. The relocated addresses in the debugging information for an executable
  5458. object are virtual addresses and the relocated addresses in the
  5459. debugging information for a shared object are offsets relative to
  5460. the start of the lowest segment used by that shared object.
  5461. .P
  5462. .I
  5463. This requirement makes the debugging information for shared objects
  5464. position independent.
  5465. Virtual addresses in a shared object may be calculated by adding the
  5466. offset to the base address at which the object was attached.
  5467. This offset is available in the run-time linker's data structures.
  5468. .H 2 "File Constraints"
  5469. All debugging information entries in a relocatable object file, 
  5470. executable object or shared
  5471. object are required to be physically contiguous.
  5472. .H 2 "Format of Debugging Information"
  5473. .IX Version 2
  5474. For each compilation unit compiled with a DWARF Version 2 producer,
  5475. .IX compilation units
  5476. .IX compilation units, header
  5477. a contribution is made to the
  5478. .Cf .debug_info
  5479. .IX \f(CW.debug_info\fP %debugai
  5480. section of the object file.  Each such contribution consists of
  5481. a compilation unit header followed by a series of debugging information
  5482. entries.  Unlike the information encoding for DWARF Version 1, Version 2
  5483. .IX Version 1
  5484. debugging information entries do not themselves contain the debugging
  5485. information entry tag or the attribute name and form encodings for
  5486. each attribute.  Instead, each debugging information entry begins with
  5487. a code that represents an entry in a separate abbreviations table.
  5488. This code is followed directly by a series of attribute values.
  5489. The appropriate entry in the abbreviations table guides the interpretation
  5490. of the information contained directly in the 
  5491. .Cf .debug_info
  5492. section.  Each compilation unit is associated with a particular
  5493. abbreviation table, but multiple compilation units may share
  5494. the same table.  
  5495. .IX abbreviations table
  5496. .I
  5497. .P
  5498. This encoding was based on the observation that typical DWARF producers
  5499. produce a very limited number of different types of debugging information
  5500. entries.  By extracting the common information from those entries
  5501. into a separate table, we are able to compress the generated information.
  5502. .R
  5503. .H 3 "Compilation Unit Header"
  5504. .IX compilation units, header
  5505. The header for the series of debugging information entries contributed
  5506. by a single compilation unit consists of the following information:
  5507. .AL
  5508. .LI
  5509. A 4-byte unsigned integer representing the length of the
  5510. .Cf .debug_info
  5511. contribution for that compilation unit, not including the length field itself.
  5512. .LI
  5513. A 2-byte unsigned integer representing the version of the DWARF information
  5514. for that compilation unit.  For DWARF Version 2, the value in this field is 2.
  5515. .IX Version 2
  5516. .LI
  5517. A 4-byte unsigned offset into the 
  5518. .Cf .debug_abbrev
  5519. .IX \f(CW.debug_abbrev\fP %debugaab
  5520. section.  This offset associates the compilation unit with a particular
  5521. set of debugging information entry abbreviations.
  5522. .LI
  5523. .IX segmented address space
  5524. .IX address space, segmented
  5525. .IX addresses, size of
  5526. A 1-byte unsigned integer representing the size in bytes of an address
  5527. on the target architecture.  If the system uses segmented addressing,
  5528. this value represents the size of the offset portion of an address.
  5529. .IX addresses, offset portion
  5530. .LE
  5531. .P
  5532. .I
  5533. The compilation unit header does not replace the
  5534. .Cf DW_TAG_compile_unit
  5535. debugging information entry.  It is additional information that
  5536. is represented outside the standard DWARF tag/attributes format.
  5537. .R
  5538. .H 3 "Debugging Information Entry"
  5539. Each debugging information entry begins with an unsigned LEB128
  5540. .IX debugging information entries
  5541. number containing the abbreviation code for the entry.
  5542. This code represents an entry within the abbreviation table associated
  5543. with the compilation unit containing this entry.  The abbreviation
  5544. .IX abbreviations table
  5545. code is followed by a series of attribute values.
  5546. .IX attributes, values
  5547. .P
  5548. On some architectures, there are alignment constraints on section boundaries.
  5549. To make it easier to pad debugging information sections to satisfy
  5550. such constraints, the abbreviation code 0 is reserved.  Debugging
  5551. information entries consisting of only the 0 abbreviation code are considered
  5552. null entries.
  5553. .IX debugging information entries, null entries
  5554. .H 3 "Abbreviation Tables"
  5555. .IX abbreviations table
  5556. The abbreviation tables for all compilation units are contained in
  5557. a separate object file section called
  5558. .Cf .debug_abbrev .
  5559. .IX \f(CW.debug_abbrev\fP %debugaab
  5560. As mentioned before, multiple compilation units may share the same
  5561. abbreviation table.  
  5562. .P
  5563. The abbreviation table for a single compilation
  5564. unit consists of a series of abbreviation declarations.
  5565. Each declaration specifies the tag and attributes for a particular
  5566. .IX tags
  5567. .IX attributes
  5568. form of debugging information entry.  Each declaration begins with
  5569. an unsigned LEB128 number representing the abbreviation code itself.
  5570. It is this code that appears at the beginning of a debugging information
  5571. entry in the
  5572. .Cf .debug_info
  5573. section.  As described above, the abbreviation code 0 is reserved for null
  5574. debugging information entries.
  5575. The abbreviation code is followed by another unsigned LEB128
  5576. number that encodes the entry's tag.
  5577. .IX tags
  5578. .nr aX \n(Fg+1
  5579. .nr bX \n(Fg+2
  5580. The encodings for the tag names are given in Figures \n(aX
  5581. and \n(bX.
  5582. .DF
  5583. .TS
  5584. box center;
  5585. l l
  5586. lf(CW) lf(CW)
  5587. Tag name    Value
  5588. _
  5589. DW_TAG_array_type    0x01
  5590. DW_TAG_class_type    0x02
  5591. DW_TAG_entry_point    0x03
  5592. DW_TAG_enumeration_type    0x04
  5593. DW_TAG_formal_parameter    0x05
  5594. DW_TAG_imported_declaration    0x08
  5595. DW_TAG_label    0x0a
  5596. DW_TAG_lexical_block    0x0b          
  5597. DW_TAG_member    0x0d
  5598. DW_TAG_pointer_type    0x0f
  5599. DW_TAG_reference_type    0x10
  5600. DW_TAG_compile_unit    0x11
  5601. DW_TAG_string_type    0x12
  5602. DW_TAG_structure_type    0x13
  5603. DW_TAG_subroutine_type    0x15
  5604. DW_TAG_typedef    0x16
  5605. DW_TAG_union_type    0x17
  5606. DW_TAG_unspecified_parameters    0x18
  5607. DW_TAG_variant    0x19
  5608. DW_TAG_common_block    0x1a
  5609. DW_TAG_common_inclusion    0x1b
  5610. DW_TAG_inheritance    0x1c
  5611. DW_TAG_inlined_subroutine    0x1d
  5612. DW_TAG_module    0x1e
  5613. DW_TAG_ptr_to_member_type    0x1f
  5614. DW_TAG_set_type    0x20
  5615. DW_TAG_subrange_type    0x21
  5616. DW_TAG_with_stmt    0x22
  5617. DW_TAG_access_declaration    0x23
  5618. DW_TAG_base_type    0x24
  5619. DW_TAG_catch_block    0x25
  5620. DW_TAG_const_type    0x26
  5621. DW_TAG_constant    0x27
  5622. DW_TAG_enumerator    0x28
  5623. DW_TAG_file_type    0x29
  5624. .TE
  5625. .FG "Tag encodings (part 1)"
  5626. .DE
  5627. .DF
  5628. .TS
  5629. box center;
  5630. l l
  5631. lf(CW) lf(CW)
  5632. Tag name    Value
  5633. _
  5634. DW_TAG_friend    0x2a
  5635. DW_TAG_namelist    0x2b
  5636. DW_TAG_namelist_item    0x2c
  5637. DW_TAG_packed_type    0x2d
  5638. DW_TAG_subprogram    0x2e
  5639. DW_TAG_template_type_param    0x2f
  5640. DW_TAG_template_value_param    0x30
  5641. DW_TAG_thrown_type    0x31
  5642. DW_TAG_try_block    0x32
  5643. DW_TAG_variant_part    0x33
  5644. DW_TAG_variable    0x34
  5645. DW_TAG_volatile_type    0x35
  5646. DW_TAG_lo_user    0x4080
  5647. DW_TAG_hi_user    0xffff
  5648. .TE
  5649. .FG "Tag encodings (part 2)"
  5650. .DE
  5651. .P
  5652. Following the tag encoding is a 1-byte value that determines
  5653. whether a debugging information entry using this abbreviation
  5654. has child entries or not.  If the value is
  5655. .Cf DW_CHILDREN_yes ,
  5656. the next physically succeeding entry of any debugging information
  5657. entry using this abbreviation is the first child of the prior entry.
  5658. If the 1-byte value following the abbreviation's tag encoding
  5659. is
  5660. .Cf DW_CHILDREN_no ,
  5661. the next physically succeeding entry of any debugging information entry
  5662. using this abbreviation is a sibling of the prior entry.  (Either
  5663. the first child or sibling entries may be null entries).
  5664. .IX debugging information entries, siblings
  5665. .IX debugging information entries, child entries
  5666. .IX debugging information entries, null entries
  5667. .nr aX \n(Fg+1
  5668. The encodings for the child determination byte are given in Figure \n(aX.
  5669. (As mentioned in section 2.3, each chain of sibling entries is
  5670. terminated by a null entry).
  5671. .IX debugging information entries, null entries
  5672. .DF
  5673. .TS
  5674. box center;
  5675. l l
  5676. lf(CW) lf(CW)
  5677. Child determination name    Value
  5678. _
  5679. DW_CHILDREN_no    0
  5680. DW_CHILDREN_yes    1
  5681. .TE
  5682. .FG "Child determination encodings"
  5683. .DE
  5684. .P
  5685. Finally, the child encoding is followed by a series of attribute specifications.
  5686. .IX attributes
  5687. Each attribute specification consists of two parts.  The first part
  5688. is an unsigned LEB128 number representing the attribute's name.
  5689. .IX attributes, names
  5690. The second part is an unsigned LEB128 number representing the
  5691. attribute's form.  The series of attribute specifications ends
  5692. .IX attributes, forms
  5693. with an entry containing 0 for the name and 0 for the form.
  5694. .P
  5695. The attribute form 
  5696. .Cf DW_FORM_indirect
  5697. is a special case.  For attributes with this form, the attribute value
  5698. itself in the
  5699. .Cf .debug_info
  5700. section begins with an unsigned LEB128 number that represents its form.
  5701. This allows producers to choose forms for particular attributes dynamically,
  5702. without having to add a new entry to the abbreviation table.
  5703. .P
  5704. The abbreviations for a given compilation unit end with an entry
  5705. consisting of a 0 byte for the abbreviation code.
  5706. .I
  5707. .P
  5708. See Appendix 2 for a depiction of the organization
  5709. of the debugging information.
  5710. .R
  5711. .H 3 "Attribute Encodings"
  5712. .nr aX \n(Fg+1
  5713. .nr bX \n(Fg+2
  5714. The encodings for the attribute names are given in Figures \n(aX
  5715. and \n(bX.
  5716. .DF
  5717. .TS
  5718. box center;
  5719. l l l
  5720. lf(CW) lf(CW) l
  5721. Attribute name    Value    Classes
  5722. _
  5723. DW_AT_sibling    0x01    reference
  5724. DW_AT_location    0x02    block, constant
  5725. DW_AT_name    0x03    string
  5726. DW_AT_ordering    0x09    constant
  5727. DW_AT_byte_size    0x0b    constant
  5728. DW_AT_bit_offset    0x0c    constant
  5729. DW_AT_bit_size    0x0d    constant
  5730. DW_AT_stmt_list    0x10    constant
  5731. DW_AT_low_pc    0x11    address
  5732. DW_AT_high_pc    0x12    address
  5733. DW_AT_language    0x13    constant
  5734. DW_AT_discr    0x15    reference
  5735. DW_AT_discr_value    0x16    constant
  5736. DW_AT_visibility    0x17    constant
  5737. DW_AT_import    0x18    reference
  5738. DW_AT_string_length    0x19    block, constant
  5739. DW_AT_common_reference    0x1a    reference
  5740. DW_AT_comp_dir    0x1b    string
  5741. DW_AT_const_value    0x1c    string, constant, block
  5742. DW_AT_containing_type    0x1d    reference
  5743. DW_AT_default_value    0x1e    reference
  5744. DW_AT_inline    0x20    constant
  5745. DW_AT_is_optional    0x21    flag
  5746. DW_AT_lower_bound    0x22    constant, reference
  5747. DW_AT_producer    0x25    string
  5748. DW_AT_prototyped    0x27    flag
  5749. DW_AT_return_addr    0x2a    block, constant
  5750. DW_AT_start_scope    0x2c    constant
  5751. DW_AT_stride_size    0x2e    constant
  5752. DW_AT_upper_bound    0x2f    constant, reference
  5753. .TE
  5754. .FG "Attribute encodings, part 1"
  5755. .DE
  5756. .DF
  5757. .TS
  5758. box center;
  5759. l l l
  5760. lf(CW) lf(CW) l
  5761. Attribute name    Value    Classes
  5762. _
  5763. DW_AT_abstract_origin    0x31    reference
  5764. DW_AT_accessibility    0x32      constant
  5765. DW_AT_address_class    0x33    constant
  5766. DW_AT_artificial    0x34    flag
  5767. DW_AT_base_types    0x35    reference
  5768. DW_AT_calling_convention    0x36    constant
  5769. DW_AT_count    0x37    constant, reference
  5770. DW_AT_data_member_location    0x38    block, reference
  5771. DW_AT_decl_column    0x39    constant
  5772. DW_AT_decl_file    0x3a    constant
  5773. DW_AT_decl_line    0x3b    constant
  5774. DW_AT_declaration    0x3c     flag
  5775. DW_AT_discr_list    0x3d     block
  5776. DW_AT_encoding    0x3e    constant
  5777. DW_AT_external    0x3f    flag
  5778. DW_AT_frame_base    0x40    block, constant
  5779. DW_AT_friend    0x41    reference
  5780. DW_AT_identifier_case    0x42    constant
  5781. DW_AT_macro_info    0x43    constant
  5782. DW_AT_namelist_item    0x44    block
  5783. DW_AT_priority    0x45     reference
  5784. DW_AT_segment    0x46    block, constant
  5785. DW_AT_specification    0x47    reference
  5786. DW_AT_static_link    0x48    block, constant
  5787. DW_AT_type    0x49    reference
  5788. DW_AT_use_location    0x4a    block, constant
  5789. DW_AT_variable_parameter    0x4b     flag
  5790. DW_AT_virtuality    0x4c     constant
  5791. DW_AT_vtable_elem_location    0x4d    block, reference
  5792. DW_AT_lo_user    0x2000    \(em
  5793. DW_AT_hi_user    0x3fff    \(em
  5794. .TE
  5795. .FG "Attribute encodings, part 2"
  5796. .DE
  5797. .P
  5798. .IX attributes, forms
  5799. The attribute form governs how the value of the attribute is encoded.
  5800. The possible forms may belong to one of the following
  5801. form classes:
  5802. .VL 18
  5803. .LI address
  5804. .IX attributes, addresses
  5805. Represented as an object of appropriate size to hold an 
  5806. address on the target machine (\f(CWDW_FORM_addr\fP).
  5807. This address is relocatable in
  5808. a relocatable object file and is relocated in an 
  5809. executable file or shared object.
  5810. .LI "block"
  5811. .IX attributes, blocks
  5812. Blocks come in four forms.  The first consists of a 1-byte length
  5813. followed by 0 to 255 contiguous information bytes  (\f(CWDW_FORM_block1\fP). 
  5814. The second consists of a 2-byte length
  5815. followed by 0 to 65,535 contiguous information bytes  (\f(CWDW_FORM_block2\fP). 
  5816. The third consists of a 4-byte length
  5817. followed by 0 to 4,294,967,295 contiguous information bytes  (\f(CWDW_FORM_block4\fP). 
  5818. The fourth consists of an unsigned LEB128 length followed by the number
  5819. of bytes specified by the length (\f(CWDW_FORM_block\fP).
  5820. In all forms, the length is the number of information bytes that follow.
  5821. The information bytes may contain any mixture of relocated (or
  5822. relocatable) addresses, references to other debugging information entries or
  5823. data bytes.
  5824. .LI "constant"
  5825. .IX attributes, constants
  5826. There are six forms of constants:
  5827. one, two, four and eight byte values (respectively,
  5828. .Cf DW_FORM_data1 ,
  5829. .Cf DW_FORM_data2 ,
  5830. .Cf DW_FORM_data4 ,
  5831. and
  5832. .Cf DW_FORM_data8 ).
  5833. .IX variable length data
  5834. .IX LEB128
  5835. There are also variable length constant data forms encoded
  5836. using LEB128 numbers (see below).  Both signed (\f(CWDW_FORM_sdata\fP)
  5837. and unsigned (\f(CWDW_FORM_udata\fP) variable length constants are available.
  5838. .LI flag
  5839. .IX attributes, flags
  5840. A flag is represented as a single byte of data (\f(CWDW_FORM_flag\fP). 
  5841. If the flag has value zero, it indicates the absence of the attribute.
  5842. If the flag has a non-zero value, it indicates the presence of
  5843. the attribute.
  5844. .LI reference
  5845. .IX attributes, references
  5846. There are two types of reference.  The first is an
  5847. offset relative to the first byte of the compilation unit header
  5848. for the compilation unit containing the reference.
  5849. The offset must refer to an entry within
  5850. that same compilation unit.  There are five forms for this
  5851. type of reference:
  5852. one, two, four and eight byte offsets (respectively,
  5853. .Cf DW_FORM_ref1 ,
  5854. .Cf DW_FORM_ref2 ,
  5855. .Cf DW_FORM_ref4 ,
  5856. and
  5857. .Cf DW_FORM_ref8 ).
  5858. There are is also an unsigned variable length offset encoded
  5859. using LEB128 numbers (\f(CWDW_FORM_ref_udata\fP).
  5860. .P
  5861. The second type of reference
  5862. is the address of any debugging information entry within
  5863. the same executable or shared object; it may refer to an entry
  5864. in a different compilation unit from the unit containing the
  5865. reference.  This type of reference (\f(CWDW_FORM_ref_addr\fP) is the
  5866. size of an address on the target architecture; it is relocatable
  5867. in a relocatable object file and relocated in an executable file
  5868. or shared object.
  5869. .P
  5870. .I
  5871. The use of compilation unit relative references will reduce
  5872. the number of link-time relocations and so speed up linking.
  5873. .P
  5874. The use of address-type references allows for the commonization
  5875. of information, such as types, across compilation units.
  5876. .R
  5877. .LI string
  5878. .IX attributes, strings
  5879. A string is a sequence of contiguous non-null bytes followed by one null
  5880. byte.  A string may be represented immediately in the debugging information
  5881. entry itself (\f(CWDW_FORM_string\fP), or may be represented as a 4-byte offset
  5882. into a string table contained in the 
  5883. .Cf .debug_str
  5884. .IX \f(CW.debug_str\fP %debugas
  5885. .IX string table
  5886. section of the object file (\f(CWDW_FORM_strp\fP).
  5887. .LE
  5888. .P
  5889. .nr aX \n(Fg+1
  5890. The form encodings are listed in Figure \n(aX.
  5891. .DF
  5892. .TS
  5893. box center;
  5894. l l l
  5895. lf(CW) lf(CW) l
  5896. Form name    Value    Class
  5897. _
  5898. DW_FORM_addr    0x01    address
  5899. DW_FORM_block2    0x03    block
  5900. DW_FORM_block4    0x04    block
  5901. DW_FORM_data2    0x05    constant
  5902. DW_FORM_data4    0x06    constant
  5903. DW_FORM_data8    0x07    constant
  5904. DW_FORM_string    0x08    string
  5905. DW_FORM_block    0x09    block
  5906. DW_FORM_block1    0x0a    block
  5907. DW_FORM_data1    0x0b    constant
  5908. DW_FORM_flag    0x0c    flag
  5909. DW_FORM_sdata    0x0d    constant
  5910. DW_FORM_strp    0x0e    string
  5911. DW_FORM_udata    0x0f    constant
  5912. DW_FORM_ref_addr    0x10    reference
  5913. DW_FORM_ref1    0x11    reference
  5914. DW_FORM_ref2    0x12    reference
  5915. DW_FORM_ref4    0x13    reference
  5916. DW_FORM_ref8    0x14    reference
  5917. DW_FORM_ref_udata    0x15    reference
  5918. DW_FORM_indirect    0x16    (see section 7.5.3)
  5919. .TE
  5920. .FG "Attribute form encodings"
  5921. .DE
  5922. .H 2 "Variable Length Data"
  5923. .IX variable length data
  5924. .IX LEB128
  5925. The special constant data forms
  5926. .Cf DW_FORM_sdata
  5927. and
  5928. .Cf DW_FORM_udata
  5929. are encoded using ``Little Endian Base 128'' (LEB128)
  5930. numbers. LEB128 is a scheme for encoding integers densely that
  5931. exploits the assumption that most integers are small in magnitude.
  5932. (This encoding is equally suitable whether the target machine
  5933. architecture represents data in big-endian or little-endian order.
  5934. It is ``little endian'' only in the sense that it avoids using space
  5935. to represent the ``big'' end of an unsigned integer, when the big
  5936. end is all zeroes or sign extension bits).
  5937. .P
  5938. .Cf DW_FORM_udata
  5939. (unsigned LEB128) numbers are encoded as follows:
  5940. start at the
  5941. low order end of an unsigned integer and chop it into 7-bit chunks.
  5942. Place each chunk into the low order 7 bits of a byte.  Typically,
  5943. several of the high order bytes will be zero; discard them.  Emit the
  5944. remaining bytes in a stream, starting with the low order byte;
  5945. set the high order bit on each byte except the last emitted byte.
  5946. The high bit of zero on the last byte indicates to the decoder
  5947. that it has encountered the last byte.
  5948. .P
  5949. The integer zero is a special case, consisting of a single zero byte.
  5950. .P
  5951. .I
  5952. .nr aX \n(Fg+1
  5953. Figure \n(aX gives some examples of
  5954. .Cf DW_FORM_udata 
  5955. numbers.  The 
  5956. .Cf 0x80
  5957. in each case is the high order bit of the byte, indicating that
  5958. an additional byte follows:
  5959. .R
  5960. .DF
  5961. .TS
  5962. box center;
  5963. l l l
  5964. nf(CW) lf(CW) lf(CW)
  5965. .
  5966. Number    First byte    Second byte
  5967. _
  5968. 2    2    \(em
  5969. 127    127    \(em
  5970. 128    0+0x80    1  
  5971. 129    1+0x80    1
  5972. 130    2+0x80    1
  5973. 12857    57+0x80    100
  5974. .TE
  5975. .FG "Examples of unsigned LEB128 encodings"
  5976. .DE
  5977. .P
  5978. The encoding for 
  5979. .Cf DW_FORM_sdata
  5980. (signed, 2s complement LEB128) numbers is similar, except that the
  5981. criterion for discarding high order bytes is not whether they are
  5982. zero, but whether they consist entirely of sign extension bits.
  5983. Consider the 32-bit integer 
  5984. .Cf -2 .
  5985. The three high level bytes of the number are sign extension, thus LEB128
  5986. would represent it as a single byte containing the low order 7 bits,
  5987. with the high order bit cleared to indicate the end of the byte
  5988. stream.  Note that there is nothing within the LEB128 representation
  5989. that indicates whether an encoded number is signed or unsigned.
  5990. The decoder must know what type of number to expect.
  5991. .P
  5992. .I
  5993. .nr aX \n(Fg+1
  5994. Figure \n(aX gives some examples of 
  5995. .Cf DW_FORM_sdata 
  5996. numbers.
  5997. .R
  5998. .P
  5999. .I
  6000. Appendix 4 gives algorithms for encoding and decoding these forms.
  6001. .R
  6002. .DF
  6003. .TS
  6004. box center;
  6005. l l l
  6006. nf(CW) lf(CW) lf(CW)
  6007. .
  6008. Number    First byte    Second byte
  6009. _
  6010. 2    2    \(em
  6011. -2    0x7e    \(em
  6012. 127    127+0x80    0
  6013. -127    1+0x80    0x7f
  6014. 128    0+0x80    1
  6015. -128    0+0x80    0x7f
  6016. 129    1+0x80    1
  6017. -129    0x7f+0x80    0x7e
  6018. .TE
  6019. .FG "Examples of signed LEB128 encodings"
  6020. .DE
  6021. .H 2 "Location Descriptions"
  6022. .H 3 "Location Expressions"
  6023. .IX locations, descriptions
  6024. .IX locations, expressions
  6025. A location expression is stored in a block of contiguous bytes.
  6026. The bytes form a set of operations.
  6027. Each location operation has a 1-byte code
  6028. that identifies that operation.  Operations can be followed
  6029. by one or more bytes of additional data.  All operations in a
  6030. location expression are concatenated from left to right.
  6031. The encodings for the operations in a location expression
  6032. .IX locations, expressions
  6033. .nr aX \n(Fg+1
  6034. .nr bX \n(Fg+2
  6035. are described in Figures \n(aX and \n(bX.
  6036. .DS
  6037. .TS
  6038. center box;
  6039. l l l l
  6040. lf(CW) lf(CW) l l
  6041. .
  6042. Operation    Code    No. of Operands    Notes
  6043. _
  6044. DW_OP_addr    0x03    1    constant address (size target specific)
  6045. DW_OP_deref    0x06    0
  6046. DW_OP_const1u    0x08    1    1-byte constant
  6047. DW_OP_const1s    0x09    1    1-byte constant
  6048. DW_OP_const2u    0x0a    1    2-byte constant
  6049. DW_OP_const2s    0x0b    1    2-byte constant
  6050. DW_OP_const4u    0x0c    1    4-byte constant
  6051. DW_OP_const4s    0x0d    1    4-byte constant
  6052. DW_OP_const8u    0x0e    1    8-byte constant
  6053. DW_OP_const8s    0x0f    1    8-byte constant
  6054. DW_OP_constu    0x10    1    ULEB128 constant
  6055. DW_OP_consts    0x11    1    SLEB128 constant
  6056. DW_OP_dup    0x12    0    
  6057. DW_OP_drop    0x13    0    
  6058. DW_OP_over    0x14    0    
  6059. DW_OP_pick    0x15    1    1-byte stack index    
  6060. DW_OP_swap    0x16    0    
  6061. DW_OP_rot    0x17    0    
  6062. DW_OP_xderef    0x18    0
  6063. DW_OP_abs    0x19    0
  6064. DW_OP_and    0x1a    0
  6065. DW_OP_div    0x1b    0
  6066. DW_OP_minus    0x1c    0
  6067. DW_OP_mod    0x1d    0
  6068. DW_OP_mul    0x1e    0
  6069. DW_OP_neg    0x1f    0
  6070. DW_OP_not    0x20    0
  6071. DW_OP_or    0x21    0
  6072. DW_OP_plus    0x22    0
  6073. DW_OP_plus_uconst    0x23    1    ULEB128 addend
  6074. DW_OP_shl    0x24    0
  6075. DW_OP_shr    0x25    0
  6076. DW_OP_shra    0x26    0
  6077. .TE
  6078. .FG "Location operation encodings, part 1"
  6079. .DE
  6080. .DS
  6081. .TS
  6082. center box;
  6083. l l l l
  6084. lf(CW) lf(CW) l l
  6085. .
  6086. Operation    Code    No. of Operands    Notes
  6087. _
  6088. DW_OP_xor    0x27    0
  6089. DW_OP_skip    0x2f    1    signed 2-byte constant
  6090. DW_OP_bra    0x28    1    signed 2-byte constant
  6091. DW_OP_eq    0x29    0    
  6092. DW_OP_ge    0x2a    0    
  6093. DW_OP_gt    0x2b    0    
  6094. DW_OP_le    0x2c    0    
  6095. DW_OP_lt    0x2d    0    
  6096. DW_OP_ne    0x2e    0    
  6097. DW_OP_lit0    0x30    0    literals 0..31 = (DW_OP_LIT0|literal)
  6098. DW_OP_lit1    0x31    0    
  6099. \.\.\.                
  6100. DW_OP_lit31    0x4f    0    
  6101. DW_OP_reg0    0x50    0    reg 0..31 = (DW_OP_REG0|regnum)
  6102. DW_OP_reg1    0x51    0
  6103. \.\.\.                
  6104. DW_OP_reg31    0x6f    0
  6105. DW_OP_breg0    0x70    1    SLEB128 offset
  6106. DW_OP_breg1    0x71    1    base reg 0..31 = (DW_OP_BREG0|regnum)
  6107. \.\.\.                
  6108. DW_OP_breg31    0x8f    1
  6109. DW_OP_regx    0x90    1    ULEB128 register
  6110. DW_OP_fbreg    0x91    1    SLEB128 offset
  6111. DW_OP_bregx    0x92    2    ULEB128 register followed by SLEB128 offset
  6112. DW_OP_piece    0x93    1    ULEB128 size of piece addressed
  6113. DW_OP_deref_size    0x94    1    1-byte size of data retrieved
  6114. DW_OP_xderef_size    0x95    1    1-byte size of data retrieved
  6115. DW_OP_nop    0x96    0
  6116. DW_OP_lo_user    0xe0        
  6117. DW_OP_hi_user    0xff        
  6118. .TE
  6119. .FG "Location operation encodings, part 2"
  6120. .DE
  6121. .H 3 "Location Lists"
  6122. .IX locations, lists
  6123. Each entry in a location list consists of two relative addresses
  6124. followed by a 2-byte length, followed by a block of contiguous
  6125. bytes.  The length specifies the number of bytes in the block
  6126. that follows.  The two addresses are the same size as used by
  6127. .Cf DW_FORM_addr
  6128. on the target machine.
  6129. .H 2 "Base Type Encodings"
  6130. .nr aX \n(Fg+1
  6131. .IX base types
  6132. .IX types, base
  6133. The values of the constants used in the
  6134. .Cf DW_AT_encoding
  6135. attribute are given in Figure \n(aX.
  6136. .DF
  6137. .TS
  6138. box center;
  6139. l l
  6140. lf(CW) lf(CW)
  6141. Base type encoding name    Value
  6142. _
  6143. DW_ATE_address    0x1
  6144. DW_ATE_boolean    0x2
  6145. DW_ATE_complex_float    0x3
  6146. DW_ATE_float    0x4
  6147. DW_ATE_signed    0x5
  6148. DW_ATE_signed_char    0x6
  6149. DW_ATE_unsigned    0x7
  6150. DW_ATE_unsigned_char    0x8
  6151. DW_ATE_lo_user    0x80
  6152. DW_ATE_hi_user    0xff
  6153. .TE
  6154. .FG "Base type encoding values"
  6155. .DE
  6156. .H 2 "Accessibility Codes"
  6157. .nr aX \n(Fg+1
  6158. .IX accessibility
  6159. .IX declarations, accessibility
  6160. The encodings of the constants used in the 
  6161. .Cf DW_AT_accessibility
  6162. attribute are given in Figure \n(aX.
  6163. .DF
  6164. .TS
  6165. box center;
  6166. l l
  6167. lf(CW) lf(CW)
  6168. Accessibility code name    Value
  6169. _
  6170. DW_ACCESS_public    1
  6171. DW_ACCESS_protected    2
  6172. DW_ACCESS_private    3
  6173. .TE
  6174. .FG "Accessibility encodings"
  6175. .DE
  6176. .H 2 "Visibility Codes"
  6177. .nr aX \n(Fg+1
  6178. The encodings of the constants used in the 
  6179. .Cf DW_AT_visibility
  6180. .IX visibility
  6181. .IX declarations, visibility
  6182. attribute are given in Figure \n(aX.
  6183. .DF
  6184. .TS
  6185. box center;
  6186. l l
  6187. lf(CW) lf(CW)
  6188. Visibility code name    Value
  6189. _
  6190. DW_VIS_local    1
  6191. DW_VIS_exported    2
  6192. DW_VIS_qualified    3
  6193. .TE
  6194. .FG "Visibility encodings"
  6195. .DE
  6196. .H 2 "Virtuality Codes"
  6197. .nr aX \n(Fg+1
  6198. .IX virtuality
  6199. The encodings of the constants used in the 
  6200. .Cf DW_AT_virtuality
  6201. attribute are given in Figure \n(aX.
  6202. .DF
  6203. .TS
  6204. box center;
  6205. l l
  6206. lf(CW) lf(CW)
  6207. Virtuality code name    Value
  6208. _
  6209. DW_VIRTUALITY_none    0
  6210. DW_VIRTUALITY_virtual    1
  6211. DW_VIRTUALITY_pure_virtual    2
  6212. .TE
  6213. .FG "Virtuality encodings"
  6214. .DE
  6215. .H 2 "Source Languages"
  6216. .nr aX \n(Fg+1
  6217. .IX languages
  6218. The encodings for source languages are given in Figure \n(aX.
  6219. Names marked with \(dg and their associated
  6220. values are reserved, but the languages
  6221. they represent are not supported in DWARF Version 2.
  6222. .DF
  6223. .TS
  6224. box center;
  6225. l l
  6226. lf(CW) lf(CW)
  6227. Language name    Value
  6228. _
  6229. DW_LANG_C89    0x0001
  6230. DW_LANG_C    0x0002
  6231. DW_LANG_Ada83\(dg    0x0003
  6232. DW_LANG_C_plus_plus    0x0004
  6233. DW_LANG_Cobol74\(dg    0x0005
  6234. DW_LANG_Cobol85\(dg    0x0006
  6235. DW_LANG_Fortran77    0x0007
  6236. DW_LANG_Fortran90    0x0008
  6237. DW_LANG_Pascal83    0x0009
  6238. DW_LANG_Modula2    0x000a
  6239. DW_LANG_lo_user    0x8000
  6240. DW_LANG_hi_user    0xffff
  6241. .TE
  6242. .FG "Language encodings"
  6243. .DE
  6244. .H 2 "Address Class Encodings"
  6245. .IX addresses, class
  6246. The value of the common address class encoding 
  6247. .Cf DW_ADDR_none
  6248. is 0.
  6249. .H 2 "Identifier Case"
  6250. .IX identifiers, case
  6251. The encodings of the constants used in the 
  6252. .Cf DW_AT_identifier_case
  6253. .nr aX \n(Fg+1
  6254. attribute are given in Figure \n(aX.
  6255. .DF
  6256. .TS
  6257. box center;
  6258. l l
  6259. lf(CW) lf(CW)
  6260. Identifier Case Name    Value
  6261. _
  6262. DW_ID_case_sensitive    0
  6263. DW_ID_up_case    1
  6264. DW_ID_down_case    2
  6265. DW_ID_case_insensitive    3
  6266. .TE
  6267. .FG "Identifier case encodings"
  6268. .DE
  6269. .H 2 "Calling Convention Encodings"
  6270. .IX calling conventions
  6271. The encodings for the values of the 
  6272. .Cf DW_AT_calling_convention 
  6273. .nr aX \n(Fg+1
  6274. attribute are given in Figure \n(aX.
  6275. .DF
  6276. .TS
  6277. box center;
  6278. l l
  6279. lf(CW) lf(CW)
  6280. Calling Convention Name    Value
  6281. _
  6282. DW_CC_normal    0x1
  6283. DW_CC_program    0x2
  6284. DW_CC_nocall    0x3
  6285. DW_CC_lo_user    0x40
  6286. DW_CC_hi_user    0xff
  6287. .TE
  6288. .FG "Calling convention encodings"
  6289. .DE
  6290. .H 2 "Inline Codes"
  6291. .IX subroutines, inline
  6292. The encodings of the constants used in the 
  6293. .Cf DW_AT_inline
  6294. .nr aX \n(Fg+1
  6295. attribute are given in Figure \n(aX.
  6296. .DF
  6297. .TS
  6298. box center;
  6299. l l
  6300. lf(CW) lf(CW)
  6301. Inline Code Name    Value
  6302. _
  6303. DW_INL_not_inlined    0
  6304. DW_INL_inlined    1
  6305. DW_INL_declared_not_inlined    2
  6306. DW_INL_declared_inlined    3
  6307. .TE
  6308. .FG "Inline encodings"
  6309. .DE
  6310. .H 2 "Array Ordering"
  6311. .IX arrays, ordering
  6312. The encodings for the values of the order attributes of arrays
  6313. .nr aX \n(Fg+1
  6314. is given in Figure \n(aX.
  6315. .DF
  6316. .TS
  6317. box center;
  6318. l l
  6319. lf(CW) lf(CW)
  6320. Ordering name    Value
  6321. _
  6322. DW_ORD_row_major    0
  6323. DW_ORD_col_major    1
  6324. .TE
  6325. .FG "Ordering encodings"
  6326. .DE
  6327. .H 2 "Discriminant Lists"
  6328. .IX variants
  6329. .IX discriminated unions
  6330. .IX discriminants
  6331. The descriptors used in the
  6332. .Cf DW_AT_dicsr_list
  6333. attribute are encoded as 1-byte constants.
  6334. .nr aX \n(Fg+1
  6335. The defined values are presented in Figure \n(aX.
  6336. .DF
  6337. .TS
  6338. box center;
  6339. l l
  6340. lf(CW) lf(CW)
  6341. Descriptor Name    Value
  6342. _
  6343. DW_DSC_label    0
  6344. DW_DSC_range    1
  6345. .TE
  6346. .FG "Discriminant descriptor encodings"
  6347. .DE
  6348. .H 2 "Name Lookup Table"
  6349. .IX lookup, by name
  6350. Each set of entries in the table of global names contained in the
  6351. .Cf .debug_pubnames
  6352. .IX \f(CW.debug_pubnames\fP %debugap
  6353. section begins with a header consisting of: a 4-byte length containing
  6354. the length of the set of entries for this compilation unit, not including
  6355. the length field itself; a 2-byte version identifier containing
  6356. the value 2 for DWARF Version 2; a 4-byte offset into the 
  6357. .Cf .debug_info 
  6358. section; and a 4-byte length containing the size in bytes
  6359. of the contents of the 
  6360. .Cf .debug_info
  6361. section generated to represent this compilation unit.
  6362. This header is followed by a series of tuples.  
  6363. Each tuple consists of a 4-byte offset
  6364. followed by a string of non-null bytes terminated by one null byte.
  6365. Each set is terminated by a 4-byte word containing the value 0.
  6366. .H 2 "Address Range Table"
  6367. .IX lookup, by address
  6368. Each set of entries in the table of address ranges contained in the
  6369. .Cf .debug_aranges
  6370. .IX \f(CW.debug_aranges\fP %debugaar
  6371. section begins with a header consisting of: a 4-byte length containing
  6372. the length of the set of entries for this compilation unit, not including
  6373. the length field itself; a 2-byte version identifier containing
  6374. the value 2 for DWARF Version 2; a 4-byte offset into the 
  6375. .Cf .debug_info
  6376. section;  a 1-byte unsigned integer containing the size in bytes of an 
  6377. address (or the offset portion of an address for segmented addressing)
  6378. .IX addresses, offset portion
  6379. .IX addresses, size of
  6380. on the target system; and a 1-byte unsigned integer containing the 
  6381. size in bytes of a segment descriptor on the target system.
  6382. This header is followed by a series of tuples.  
  6383. Each tuple consists of an address and a length, each
  6384. in the size appropriate for an address on the target architecture.
  6385. The first tuple following the header in each set begins at
  6386. an offset that is a multiple of the size of a single tuple
  6387. (that is, twice the size of an address).  The header is
  6388. padded, if necessary, to the appropriate boundary.
  6389. Each set of tuples is terminated by a 0 for the address and 0 for the length.
  6390. .H 2 "Line Number Information"
  6391. .IX line number information
  6392. .IX line number information, definitions
  6393. The sizes of the integers used in the line number and
  6394. call frame information sections are as follows:
  6395. .VL 15
  6396. .LI "sbyte"
  6397. Signed 1-byte value.
  6398. .LI "ubyte"
  6399. Unsigned 1-byte value.
  6400. .LI "uhalf"
  6401. Unsigned 2-byte value.
  6402. .LI "sword"
  6403. Signed 4-byte value.
  6404. .LI "uword"
  6405. Unsigned 4-byte value.
  6406. .LI
  6407. .LE
  6408. .P
  6409. .IX Version 2
  6410. The version number in the statement program prologue is 2 for
  6411. DWARF Version 2.
  6412. The boolean values ``true'' and ``false'' used by the statement
  6413. information program are encoded as a single byte containing the
  6414. value 0 for ``false,'' and a non-zero value for ``true.''
  6415. The encodings for the pre-defined standard opcodes are given
  6416. .IX line number information, standard opcodes
  6417. .nr aX \n(Fg+1
  6418. in Figure \n(aX.
  6419. .DF
  6420. .TS
  6421. box center;
  6422. l l
  6423. lf(CW)    lf(CW)
  6424. .
  6425. Opcode Name    Value
  6426. _
  6427. DW_LNS_copy    1
  6428. DW_LNS_advance_pc    2
  6429. DW_LNS_advance_line    3
  6430. DW_LNS_set_file    4
  6431. DW_LNS_set_column    5
  6432. DW_LNS_negate_stmt    6
  6433. DW_LNS_set_basic_block    7
  6434. DW_LNS_const_add_pc    8
  6435. DW_LNS_fixed_advance_pc    9
  6436. .TE
  6437. .FG "Standard Opcode Encodings"
  6438. .DE
  6439. The encodings for the pre-defined extended opcodes are given
  6440. .IX line number information, extended opcodes
  6441. .nr aX \n(Fg+1
  6442. in Figure \n(aX.
  6443. .DF
  6444. .TS
  6445. box center;
  6446. l l
  6447. lf(CW) lf(CW)
  6448. .
  6449. Opcode Name    Value
  6450. _
  6451. DW_LNE_end_sequence    1
  6452. DW_LNE_set_address    2
  6453. DW_LNE_define_file    3
  6454. .TE
  6455. .FG "Extended Opcode Encodings"
  6456. .DE
  6457. .H 2 "Macro Information"
  6458. .IX macro information
  6459. .IX source, files
  6460. The source line numbers and source file indices encoded in the
  6461. macro information section are represented as unsigned LEB128 numbers
  6462. as are the constants in an
  6463. .Cf DW_MACINFO_vendor_ext
  6464. entry.
  6465. The macinfo type is encoded as a single byte.  The encodings are given
  6466. .nr aX \n(Fg+1
  6467. in Figure \n(aX.
  6468. .DF
  6469. .TS
  6470. box center;
  6471. l l
  6472. lf(CW)    lf(CW)
  6473. .
  6474. Macinfo Type Name    Value
  6475. _
  6476. DW_MACINFO_define    1
  6477. DW_MACINFO_undef    2
  6478. DW_MACINFO_start_file    3
  6479. DW_MACINFO_end_file    4
  6480. DW_MACINFO_vendor_ext    255
  6481. .TE
  6482. .FG "Macinfo Type Encodings"
  6483. .DE
  6484. .H 2 "Call Frame Information"
  6485. .IX call frame information
  6486. The value of the CIE id in the CIE header is
  6487. .Cf 0xffffffff .
  6488. The initial value of the CIE version number is 1.
  6489. .P
  6490. Call frame instructions are encoded in one or more bytes.
  6491. .IX call frame information, instructions
  6492. The primary opcode is encoded in the high order two bits of 
  6493. the first byte (that is, opcode = byte >> 6).
  6494. An operand or extended opcode may be encoded in the low order
  6495. 6 bits.   Additional operands are encoded in subsequent bytes.
  6496. The instructions and their encodings are presented
  6497. .nr aX \n(Fg+1
  6498. in Figure \n(aX.
  6499. .DS
  6500. .TS
  6501. center box;
  6502. l l l l l
  6503. lf(CW) lf(CW) l l
  6504. lf(CW) lf(CW) l l
  6505. lf(CW) lf(CW) l l
  6506. lf(CW) lf(CW) lf(CW) l.
  6507. Instruction    High 2 Bits    Low 6 Bits    Operand 1    Operand 2
  6508. _
  6509. DW_CFA_advance_loc    0x1    delta        
  6510. DW_CFA_offset    0x2    register    ULEB128 offset
  6511. DW_CFA_restore    0x3    register
  6512. DW_CFA_set_loc    0    0x01    address
  6513. DW_CFA_advance_loc1    0    0x02    1-byte delta
  6514. DW_CFA_advance_loc2    0    0x03    2-byte delta
  6515. DW_CFA_advance_loc4    0    0x04    4-byte delta
  6516. DW_CFA_offset_extended    0    0x05    ULEB128 register    ULEB128 offset
  6517. DW_CFA_restore_extended    0    0x06    ULEB128 register
  6518. DW_CFA_undefined    0    0x07    ULEB128 register
  6519. DW_CFA_same_value    0    0x08    ULEB128 register
  6520. DW_CFA_register    0    0x09    ULEB128 register    ULEB128 register
  6521. DW_CFA_remember_state    0    0x0a
  6522. DW_CFA_restore_state    0    0x0b
  6523. DW_CFA_def_cfa    0    0x0c    ULEB128 register    ULEB128 offset
  6524. DW_CFA_def_cfa_register    0    0x0d    ULEB128 register
  6525. DW_CFA_def_cfa_offset    0    0x0e    ULEB128 offset
  6526. DW_CFA_nop    0    0
  6527. DW_CFA_lo_user    0    0x1c
  6528. DW_CFA_hi_user    0    0x3f
  6529. .TE
  6530. .FG "Call frame instruction encodings"
  6531. .DE
  6532. .H 2 "Dependencies"
  6533. The debugging information in this format is intended to exist in the
  6534. .Cf .debug_abbrev ,
  6535. .Cf .debug_aranges ,
  6536. .Cf .debug_frame ,
  6537. .Cf .debug_info ,
  6538. .Cf .debug_line ,
  6539. .Cf .debug_loc ,
  6540. .Cf .debug_macinfo ,
  6541. .Cf .debug_pubnames 
  6542. and
  6543. .Cf .debug_str
  6544. .IX \f(CW.debug_abbrev\fP %debugaab
  6545. .IX \f(CW.debug_aranges\fP %debugaar
  6546. .IX \f(CW.debug_frame\fP %debugaf
  6547. .IX \f(CW.debug_info\fP %debugai
  6548. .IX \f(CW.debug_line\fP %debugali
  6549. .IX \f(CW.debug_loc\fP %debugalo
  6550. .IX \f(CW.debug_macinfo\fP %debugam
  6551. .IX \f(CW.debug_pubnames\fP %debugap
  6552. .IX \f(CW.debug_str\fP %debugas
  6553. sections of an object file.
  6554. The information is not word-aligned, so the assembler must provide a
  6555. way for the compiler to produce 2-byte and 4-byte quantities without
  6556. alignment restrictions, and the linker must be able to
  6557. relocate a 4-byte reference at an arbitrary alignment.
  6558. In target architectures with 64-bit addresses, the assembler and linker
  6559. must similarly handle 8-byte references at arbitrary alignments.
  6560. .OP
  6561. .H 1 "FUTURE DIRECTIONS"
  6562. The \*(iX \*(tE is working on a specification for a set of interfaces
  6563. for reading DWARF information, that will hide changes in the
  6564. representation of that information from its consumers.  It is
  6565. hoped that using these interfaces will make the transition from
  6566. DWARF Version 1 to Version 2 much simpler and will make it
  6567. easier for a single consumer to support objects using either
  6568. Version 1 or Version 2 DWARF.
  6569. .P
  6570. A draft of this specification is available for review from
  6571. \*(iX. The \*(tE wishes to stress, however, that the specification
  6572. is still in flux.
  6573. .OP
  6574. .HU "Appendix 1 -- Current Attributes by Tag Value"
  6575. .P
  6576. The list below enumerates the attributes that are most applicable to each type
  6577. of debugging information entry.
  6578. DWARF does not in general require that a given debugging information
  6579. entry contain a particular attribute or set of attributes.  Instead, a
  6580. DWARF producer is free to generate any, all, or none of the attributes
  6581. described in the text as being applicable to a given entry.  Other
  6582. attributes (both those defined within this document but not explicitly
  6583. associated with the entry in question, and new, vendor-defined ones)
  6584. may also appear in a given debugging entry.
  6585. Therefore, the list may be
  6586. taken as instructive, but cannot be considered definitive.
  6587. .sp
  6588. .sp
  6589. .DS
  6590. .TS
  6591. box, tab(:) ;
  6592. lfB lfB
  6593. lf(CW) lf(CW) .
  6594. TAG NAME:APPLICABLE ATTRIBUTES
  6595. _
  6596. DW_TAG_access_declaration:DECL\(dg
  6597. :DW_AT_accessibility
  6598. :DW_AT_name
  6599. :DW_AT_sibling
  6600. _
  6601. DW_TAG_array_type:DECL
  6602. :DW_AT_abstract_origin
  6603. :DW_AT_accessibility
  6604. :DW_AT_byte_size
  6605. :DW_AT_declaration
  6606. :DW_AT_name
  6607. :DW_AT_ordering
  6608. :DW_AT_sibling
  6609. :DW_AT_start_scope
  6610. :DW_AT_stride_size
  6611. :DW_AT_type
  6612. :DW_AT_visibility
  6613. _
  6614. DW_TAG_base_type:DW_AT_bit_offset
  6615. :DW_AT_bit_size
  6616. :DW_AT_byte_size
  6617. :DW_AT_encoding
  6618. :DW_AT_name
  6619. :DW_AT_sibling
  6620. _
  6621. DW_TAG_catch_block:DW_AT_abstract_origin
  6622. :DW_AT_high_pc
  6623. :DW_AT_low_pc
  6624. :DW_AT_segment
  6625. :DW_AT_sibling
  6626. .TE
  6627. .DE
  6628. .br
  6629. \(dg
  6630. .Cf DW_AT_decl_column ,
  6631. .Cf DW_AT_decl_file ,
  6632. .Cf DW_AT_decl_line .
  6633. .SK
  6634. .DS
  6635. .B "Appendix 1 (cont'd) -- Current Attributes by Tag Value"
  6636.  
  6637.  
  6638.  
  6639. .TS
  6640. box, tab(:) ;
  6641. lfB lfB
  6642. lf(CW) lf(CW) .
  6643. TAG NAME:APPLICABLE ATTRIBUTES
  6644. _
  6645. DW_TAG_class_type:DECL
  6646. :DW_AT_abstract_origin
  6647. :DW_AT_accessibility
  6648. :DW_AT_byte_size
  6649. :DW_AT_declaration
  6650. :DW_AT_name
  6651. :DW_AT_sibling
  6652. :DW_AT_start_scope
  6653. :DW_AT_visibility
  6654. _
  6655. DW_TAG_common_block:DECL
  6656. :DW_AT_declaration
  6657. :DW_AT_location
  6658. :DW_AT_name
  6659. :DW_AT_sibling
  6660. :DW_AT_visibility
  6661. _
  6662. DW_TAG_common_inclusion:DECL
  6663. :DW_AT_common_reference
  6664. :DW_AT_declaration
  6665. :DW_AT_sibling
  6666. :DW_AT_visibility
  6667. _
  6668. DW_TAG_compile_unit:DW_AT_base_types
  6669. :DW_AT_comp_dir
  6670. :DW_AT_identifier_case
  6671. :DW_AT_high_pc
  6672. :DW_AT_language
  6673. :DW_AT_low_pc
  6674. :DW_AT_macro_info
  6675. :DW_AT_name
  6676. :DW_AT_producer
  6677. :DW_AT_sibling
  6678. :DW_AT_stmt_list
  6679. _
  6680. DW_TAG_const_type:DW_AT_sibling
  6681. :DW_AT_type
  6682. .TE
  6683. .DE
  6684. .br
  6685. .SK
  6686. .DS
  6687. .B "Appendix 1 (cont'd) -- Current Attributes by Tag Value"
  6688.  
  6689.  
  6690.  
  6691. .TS
  6692. box, tab(:) ;
  6693. lfB lfB
  6694. lf(CW) lf(CW) .
  6695. TAG NAME:APPLICABLE ATTRIBUTES
  6696. _
  6697. DW_TAG_constant:DECL
  6698. :DW_AT_accessibility
  6699. :DW_AT_constant_value
  6700. :DW_AT_declaration
  6701. :DW_AT_external
  6702. :DW_AT_name
  6703. :DW_AT_sibling
  6704. :DW_AT_start_scope
  6705. :DW_AT_type
  6706. :DW_AT_visibility
  6707. _
  6708. DW_TAG_entry_point:DW_AT_address_class
  6709. :DW_AT_low_pc
  6710. :DW_AT_name
  6711. :DW_AT_return_addr
  6712. :DW_AT_segment
  6713. :DW_AT_sibling
  6714. :DW_AT_static_link
  6715. :DW_AT_type
  6716. _
  6717. DW_TAG_enumeration_type:DECL
  6718. :DW_AT_abstract_origin
  6719. :DW_AT_accessibility
  6720. :DW_AT_byte_size
  6721. :DW_AT_declaration
  6722. :DW_AT_name
  6723. :DW_AT_sibling
  6724. :DW_AT_start_scope
  6725. :DW_AT_visibility
  6726. _
  6727. DW_TAG_enumerator:DECL
  6728. :DW_AT_const_value
  6729. :DW_AT_name
  6730. :DW_AT_sibling
  6731. _
  6732. DW_TAG_file_type:DECL
  6733. :DW_AT_abstract_origin
  6734. :DW_AT_byte_size
  6735. :DW_AT_name
  6736. :DW_AT_sibling
  6737. :DW_AT_start_scope
  6738. :DW_AT_type
  6739. :DW_AT_visibility
  6740. .TE
  6741. .DE
  6742. .br
  6743. .SK
  6744. .DS
  6745. .B "Appendix 1 (cont'd) -- Current Attributes by Tag Value"
  6746.  
  6747.  
  6748.  
  6749. .TS
  6750. box, tab(:) ;
  6751. lfB lfB
  6752. lf(CW) lf(CW) .
  6753. TAG NAME:APPLICABLE ATTRIBUTES
  6754. _
  6755. DW_TAG_formal_parameter:DECL
  6756. :DW_AT_abstract_origin
  6757. :DW_AT_artificial
  6758. :DW_AT_default_value
  6759. :DW_AT_is_optional
  6760. :DW_AT_location
  6761. :DW_AT_name
  6762. :DW_AT_segment
  6763. :DW_AT_sibling
  6764. :DW_AT_type
  6765. :DW_AT_variable_parameter
  6766. _
  6767. DW_TAG_friend:DECL
  6768. :DW_AT_abstract_origin
  6769. :DW_AT_friend
  6770. :DW_AT_sibling
  6771. _
  6772. DW_TAG_imported_declaration:DECL
  6773. :DW_AT_accessibility
  6774. :DW_AT_import
  6775. :DW_AT_name
  6776. :DW_AT_sibling
  6777. :DW_AT_start_scope
  6778. _
  6779. DW_TAG_inheritance:DECL
  6780. :DW_AT_accessibility
  6781. :DW_AT_data_member_location
  6782. :DW_AT_sibling
  6783. :DW_AT_type
  6784. :DW_AT_virtuality
  6785. _
  6786. DW_TAG_inlined_subroutine:DECL
  6787. :DW_AT_abstract_origin
  6788. :DW_AT_high_pc
  6789. :DW_AT_low_pc
  6790. :DW_AT_segment
  6791. :DW_AT_sibling
  6792. :DW_AT_return_addr
  6793. :DW_AT_start_scope
  6794. _
  6795. DW_TAG_label:DW_AT_abstract_origin
  6796. :DW_AT_low_pc
  6797. :DW_AT_name
  6798. :DW_AT_segment
  6799. :DW_AT_start_scope
  6800. :DW_AT_sibling
  6801. .TE
  6802. .DE
  6803. .br
  6804. .SK
  6805. .DS
  6806. .B "Appendix 1 (cont'd) -- Current Attributes by Tag Value"
  6807.  
  6808.  
  6809.  
  6810. .TS
  6811. box, tab(:) ;
  6812. lfB lfB
  6813. lf(CW) lf(CW) .
  6814. TAG NAME:APPLICABLE ATTRIBUTES
  6815. _
  6816. DW_TAG_lexical_block:DW_AT_abstract_origin
  6817. :DW_AT_high_pc
  6818. :DW_AT_low_pc
  6819. :DW_AT_name
  6820. :DW_AT_segment
  6821. :DW_AT_sibling
  6822. _
  6823. DW_TAG_member:DECL
  6824. :DW_AT_accessibility
  6825. :DW_AT_byte_size
  6826. :DW_AT_bit_offset
  6827. :DW_AT_bit_size
  6828. :DW_AT_data_member_location
  6829. :DW_AT_declaration
  6830. :DW_AT_name
  6831. :DW_AT_sibling
  6832. :DW_AT_type
  6833. :DW_AT_visibility
  6834. _
  6835. DW_TAG_module:DECL
  6836. :DW_AT_accessibility
  6837. :DW_AT_declaration
  6838. :DW_AT_high_pc
  6839. :DW_AT_low_pc
  6840. :DW_AT_name
  6841. :DW_AT_priority
  6842. :DW_AT_segment
  6843. :DW_AT_sibling
  6844. :DW_AT_visibility
  6845. _
  6846. DW_TAG_namelist:DECL
  6847. :DW_AT_accessibility
  6848. :DW_AT_abstract_origin
  6849. :DW_AT_declaration
  6850. :DW_AT_sibling
  6851. :DW_AT_visibility
  6852. _
  6853. DW_TAG_namelist_item:DECL
  6854. :DW_AT_namelist_item
  6855. :DW_AT_sibling
  6856. _
  6857. DW_TAG_packed_type:DW_AT_sibling
  6858. :DW_AT_type
  6859. .TE
  6860. .DE
  6861. .br
  6862. .SK
  6863. .DS
  6864. .B "Appendix 1 (cont'd) -- Current Attributes by Tag Value"
  6865.  
  6866.  
  6867.  
  6868. .TS
  6869. box, tab(:) ;
  6870. lfB lfB
  6871. lf(CW) lf(CW) .
  6872. TAG NAME:APPLICABLE ATTRIBUTES
  6873. _
  6874. DW_TAG_pointer_type:DW_AT_address_class
  6875. :DW_AT_sibling
  6876. :DW_AT_type
  6877. _
  6878. DW_TAG_ptr_to_member_type:DECL
  6879. :DW_AT_abstract_origin
  6880. :DW_AT_address_class
  6881. :DW_AT_containing_type
  6882. :DW_AT_declaration
  6883. :DW_AT_name
  6884. :DW_AT_sibling
  6885. :DW_AT_type
  6886. :DW_AT_use_location
  6887. :DW_AT_visibility
  6888. _
  6889. DW_TAG_reference_type:DW_AT_address_class
  6890. :DW_AT_sibling
  6891. :DW_AT_type
  6892. _
  6893. DW_TAG_set_type:DECL
  6894. :DW_AT_abstract_origin
  6895. :DW_AT_accessibility
  6896. :DW_AT_byte_size
  6897. :DW_AT_declaration
  6898. :DW_AT_name
  6899. :DW_AT_start_scope
  6900. :DW_AT_sibling
  6901. :DW_AT_type
  6902. :DW_AT_visibility
  6903. _
  6904. DW_TAG_string_type:DECL
  6905. :DW_AT_accessibility
  6906. :DW_AT_abstract_origin
  6907. :DW_AT_byte_size
  6908. :DW_AT_declaration
  6909. :DW_AT_name
  6910. :DW_AT_segment
  6911. :DW_AT_sibling
  6912. :DW_AT_start_scope
  6913. :DW_AT_string_length
  6914. :DW_AT_visibility
  6915. .TE
  6916. .DE
  6917. .SK
  6918. .DS
  6919. .B "Appendix 1 (cont'd) -- Current Attributes by Tag Value"
  6920.  
  6921.  
  6922.  
  6923. .TS
  6924. box, tab(:) ;
  6925. lfB lfB
  6926. lf(CW) lf(CW) .
  6927. TAG NAME:APPLICABLE ATTRIBUTES
  6928. _
  6929. DW_TAG_structure_type:DECL
  6930. :DW_AT_abstract_origin
  6931. :DW_AT_accessibility
  6932. :DW_AT_byte_size
  6933. :DW_AT_declaration
  6934. :DW_AT_name
  6935. :DW_AT_sibling
  6936. :DW_AT_start_scope
  6937. :DW_AT_visibility
  6938. _
  6939. DW_TAG_subprogram:DECL
  6940. :DW_AT_abstract_origin
  6941. :DW_AT_accessibility
  6942. :DW_AT_address_class
  6943. :DW_AT_artificial
  6944. :DW_AT_calling_convention
  6945. :DW_AT_declaration
  6946. :DW_AT_external
  6947. :DW_AT_frame_base
  6948. :DW_AT_high_pc
  6949. :DW_AT_inline
  6950. :DW_AT_low_pc
  6951. :DW_AT_name
  6952. :DW_AT_prototyped
  6953. :DW_AT_return_addr
  6954. :DW_AT_segment
  6955. :DW_AT_sibling
  6956. :DW_AT_specification
  6957. :DW_AT_start_scope
  6958. :DW_AT_static_link
  6959. :DW_AT_type
  6960. :DW_AT_visibility
  6961. :DW_AT_virtuality
  6962. :DW_AT_vtable_elem_location
  6963. .TE
  6964. .DE
  6965. .SK
  6966. .DS
  6967. .B "Appendix 1 (cont'd) -- Current Attributes by Tag Value"
  6968.  
  6969.  
  6970.  
  6971. .TS
  6972. box, tab(:) ;
  6973. lfB lfB
  6974. lf(CW) lf(CW) .
  6975. TAG NAME:APPLICABLE ATTRIBUTES
  6976. _
  6977. DW_TAG_subrange_type:DECL
  6978. :DW_AT_abstract_origin
  6979. :DW_AT_accessibility
  6980. :DW_AT_byte_size
  6981. :DW_AT_count
  6982. :DW_AT_declaration
  6983. :DW_AT_lower_bound
  6984. :DW_AT_name
  6985. :DW_AT_sibling
  6986. :DW_AT_type
  6987. :DW_AT_upper_bound
  6988. :DW_AT_visibility
  6989. _
  6990. DW_TAG_subroutine_type:DECL
  6991. :DW_AT_abstract_origin
  6992. :DW_AT_accessibility
  6993. :DW_AT_address_class
  6994. :DW_AT_declaration
  6995. :DW_AT_name
  6996. :DW_AT_prototyped
  6997. :DW_AT_sibling
  6998. :DW_AT_start_scope
  6999. :DW_AT_type
  7000. :DW_AT_visibility
  7001. _
  7002. DW_TAG_template_type_param:DECL
  7003. :DW_AT_name
  7004. :DW_AT_sibling
  7005. :DW_AT_type
  7006. _
  7007. DW_TAG_template_value_param:DECL
  7008. :DW_AT_name
  7009. :DW_AT_const_value
  7010. :DW_AT_sibling
  7011. :DW_AT_type
  7012. _
  7013. DW_TAG_thrown_type:DECL
  7014. :DW_AT_sibling
  7015. :DW_AT_type
  7016. _
  7017. DW_TAG_try_block:DW_AT_abstract_origin
  7018. :DW_AT_high_pc
  7019. :DW_AT_low_pc
  7020. :DW_AT_segment
  7021. :DW_AT_sibling
  7022. .TE
  7023. .DE
  7024. .br
  7025. .SK
  7026. .DS
  7027. .B "Appendix 1 (cont'd) -- Current Attributes by Tag Value"
  7028.  
  7029.  
  7030.  
  7031. .TS
  7032. box, tab(:) ;
  7033. lfB lfB
  7034. lf(CW) lf(CW) .
  7035. TAG NAME:APPLICABLE ATTRIBUTES
  7036. _
  7037. DW_TAG_typedef:DECL
  7038. :DW_AT_abstract_origin
  7039. :DW_AT_accessibility
  7040. :DW_AT_declaration
  7041. :DW_AT_name
  7042. :DW_AT_sibling
  7043. :DW_AT_start_scope
  7044. :DW_AT_type
  7045. :DW_AT_visibility
  7046. _
  7047. DW_TAG_union_type:DECL
  7048. :DW_AT_abstract_origin
  7049. :DW_AT_accessibility
  7050. :DW_AT_byte_size
  7051. :DW_AT_declaration
  7052. :DW_AT_friends
  7053. :DW_AT_name
  7054. :DW_AT_sibling
  7055. :DW_AT_start_scope
  7056. :DW_AT_visibility
  7057. _
  7058. DW_TAG_unspecified_parameters:DECL
  7059. :DW_AT_abstract_origin
  7060. :DW_AT_artificial
  7061. :DW_AT_sibling
  7062. _
  7063. DW_TAG_variable:DECL
  7064. :DW_AT_accessibility
  7065. :DW_AT_constant_value
  7066. :DW_AT_declaration
  7067. :DW_AT_external
  7068. :DW_AT_location
  7069. :DW_AT_name
  7070. :DW_AT_segment
  7071. :DW_AT_sibling
  7072. :DW_AT_specification
  7073. :DW_AT_start_scope
  7074. :DW_AT_type
  7075. :DW_AT_visibility
  7076. .TE
  7077. .DE
  7078. .br
  7079. .SK
  7080. .DS
  7081. .B "Appendix 1 (cont'd) -- Current Attributes by Tag Value"
  7082.  
  7083.  
  7084.  
  7085. .TS
  7086. box, tab(:) ;
  7087. lfB lfB
  7088. lf(CW) lf(CW) .
  7089. TAG NAME:APPLICABLE ATTRIBUTES
  7090. _
  7091. DW_TAG_variant:DECL
  7092. :DW_AT_accessibility
  7093. :DW_AT_abstract_origin
  7094. :DW_AT_declaration
  7095. :DW_AT_discr_list
  7096. :DW_AT_discr_value
  7097. :DW_AT_sibling
  7098. _
  7099. DW_TAG_variant_part:DECL
  7100. :DW_AT_accessibility
  7101. :DW_AT_abstract_origin
  7102. :DW_AT_declaration
  7103. :DW_AT_discr
  7104. :DW_AT_sibling
  7105. :DW_AT_type
  7106. _
  7107. DW_TAG_volatile_type:DW_AT_sibling
  7108. :DW_AT_type
  7109. _
  7110. DW_TAG_with_statement:DW_AT_accessibility
  7111. :DW_AT_address_class
  7112. :DW_AT_declaration
  7113. :DW_AT_high_pc
  7114. :DW_AT_location
  7115. :DW_AT_low_pc
  7116. :DW_AT_segment
  7117. :DW_AT_sibling
  7118. :DW_AT_type
  7119. :DW_AT_visibility
  7120. .TE
  7121. .DE
  7122. .SK
  7123. .OP
  7124. .HU "Appendix 2 -- Organization of Debugging Information"
  7125. The following diagram depicts the relationship of the abbreviation
  7126. tables contained in the 
  7127. .Cf .debug_abbrev
  7128. section to the information contained in the 
  7129. .Cf .debug_info
  7130. section.  Values are given in symbolic form, where possible.
  7131. .DF
  7132. .nf
  7133. .PS
  7134. scale=100
  7135. define t201 |
  7136. [ box invis ht 154 wid 295 with .sw at 0,0
  7137. "\f(CW\s9\&1\f1\s0" at 0,147 ljust
  7138. "\f(CW\s9\&DW_TAG_compile_unit\f1\s0" at 0,133 ljust
  7139. "\f(CW\s9\&DW_CHILDREN_yes\f1\s0" at 0,119 ljust
  7140. "\f(CW\s9\&DW_AT_name          DW_FORM_string\f1\s0" at 0,105 ljust
  7141. "\f(CW\s9\&DW_AT_producer      DW_FORM_string\f1\s0" at 0,91 ljust
  7142. "\f(CW\s9\&DW_AT_compdir       DW_FORM_string\f1\s0" at 0,77 ljust
  7143. "\f(CW\s9\&DW_AT_language      DW_FORM_data1\f1\s0" at 0,63 ljust
  7144. "\f(CW\s9\&DW_AT_low_poc       DW_FORM_addr\f1\s0" at 0,49 ljust
  7145. "\f(CW\s9\&DW_AT_high_pc       DW_FORM_addr\f1\s0" at 0,35 ljust
  7146. "\f(CW\s9\&DW_AT_stmt_list     DW_FORM_indirect\f1\s0" at 0,21 ljust
  7147. "\f(CW\s9\&0                   0\f1\s0" at 0,7 ljust
  7148. ] |
  7149.  
  7150. define t103 |
  7151. [ box invis ht 42 wid 74 with .sw at 0,0
  7152. "\f(CW\s9\&4\f1\s0" at 0,35 ljust
  7153. "\f(CW\s9\&\"POINTER\"\f1\s0" at 0,21 ljust
  7154. "\f(CW\s9\&\f1\s0" at 0,7 ljust
  7155. ] |
  7156.  
  7157. define t177 |
  7158. [ box invis ht 28 wid 13 with .sw at 0,0
  7159. "\f(CW\s9\&3\f1\s0" at 0,21 ljust
  7160. "\f(CW\s9\&\f1\s0" at 0,7 ljust
  7161. ] |
  7162.  
  7163. define t224 |
  7164. [ box invis ht 84 wid 280 with .sw at 0,0
  7165. "\f(CW\s9\&4\f1\s0" at 0,77 ljust
  7166. "\f(CW\s9\&DW_TAG_typedef\f1\s0" at 0,63 ljust
  7167. "\f(CW\s9\&DW_CHILDREN_no\f1\s0" at 0,49 ljust
  7168. "\f(CW\s9\&DW_AT_name          DW_FORM_string\f1\s0" at 0,35 ljust
  7169. "\f(CW\s9\&DW_AT_type          DW_FORM_ref4 \f1\s0" at 0,21 ljust
  7170. "\f(CW\s9\&0                   0            \f1\s0" at 0,7 ljust
  7171. ] |
  7172.  
  7173. define t149 |
  7174. [ box invis ht 28 wid 51 with .sw at 0,0
  7175. "\f(CW\s9\&4\f1\s0" at 0,21 ljust
  7176. "\f(CW\s9\&\"strp\"\f1\s0" at 0,7 ljust
  7177. ] |
  7178.  
  7179. define t205 |
  7180. [ box invis ht 98 wid 280 with .sw at 0,0
  7181. "\f(CW\s9\&2\f1\s0" at 0,91 ljust
  7182. "\f(CW\s9\&DW_TAG_base_type\f1\s0" at 0,77 ljust
  7183. "\f(CW\s9\&DW_CHILDREN_no\f1\s0" at 0,63 ljust
  7184. "\f(CW\s9\&DW_AT_name          DW_FORM_string\f1\s0" at 0,49 ljust
  7185. "\f(CW\s9\&DW_AT_encoding      DW_FORM_data1\f1\s0" at 0,35 ljust
  7186. "\f(CW\s9\&DW_AT_byte_size     DW_FORM_data1\f1\s0" at 0,21 ljust
  7187. "\f(CW\s9\&0                   0\f1\s0" at 0,7 ljust
  7188. ] |
  7189.  
  7190. define t126 |
  7191. [ box invis ht 126 wid 257 with .sw at 0,0
  7192. "\f(CW\s9\&\"myfile.c\"\f1\s0" at 0,119 ljust
  7193. "\f(CW\s9\&\"Best Compiler Corp: Version 1.3\"\f1\s0" at 0,105 ljust
  7194. "\f(CW\s9\&\"mymachine:/home/mydir/src:\"\f1\s0" at 0,91 ljust
  7195. "\f(CW\s9\&DW_LANG_C89\f1\s0" at 0,77 ljust
  7196. "\f(CW\s9\&0x0\f1\s0" at 0,63 ljust
  7197. "\f(CW\s9\&0x55\f1\s0" at 0,49 ljust
  7198. "\f(CW\s9\&DW_FORM_data4\f1\s0" at 0,35 ljust
  7199. "\f(CW\s9\&0x0\f1\s0" at 0,21 ljust
  7200. "\f(CW\s9\&\f1\s0" at 0,7 ljust
  7201. ] |
  7202.  
  7203. define t219 |
  7204. [ box invis ht 70 wid 260 with .sw at 0,0
  7205. "\f(CW\s9\&3\f1\s0" at 0,63 ljust
  7206. "\f(CW\s9\&DW_TAG_pointer_type\f1\s0" at 0,49 ljust
  7207. "\f(CW\s9\&DW_CHILDREN_no\f1\s0" at 0,35 ljust
  7208. "\f(CW\s9\&DW_AT_type          DW_FORM_ref4\f1\s0" at 0,21 ljust
  7209. "\f(CW\s9\&0                   0\f1\s0" at 0,7 ljust
  7210. ] |
  7211.  
  7212. define t109 |
  7213. [ box invis ht 42 wid 165 with .sw at 0,0
  7214. "\f(CW\s9\&\"char\"\f1\s0" at 0,35 ljust
  7215. "\f(CW\s9\&DW_ATE_unsigned_char\f1\s0" at 0,21 ljust
  7216. "\f(CW\s9\&1\f1\s0" at 0,7 ljust
  7217. ] |
  7218.  
  7219. box invis ht 704 wid 680 with .sw at 0,0
  7220. t201 with .nw at 376,657
  7221. box ht 520 wid 320 with .nw at 360,672 
  7222. box ht 208 wid 280 with .nw at 24,208 
  7223. t103 with .nw at 40,353
  7224. t177 with .nw at 40,398
  7225. line  from 360,176 to 680,176 
  7226. line  from 360,280 to 680,280 
  7227. line  from 360,368 to 680,368 
  7228. line  from 360,488 to 680,488 
  7229. t224 with .nw at 376,270
  7230. "\f(CW\s9\&0\f1\s0" at 376,164 ljust
  7231. "\f(CW\s9\&0\f1\s0" at 40,289 ljust
  7232. "\fI\s9\&e2\f1\s0" at 40,317 ljust
  7233. "\fI\s9\&e2:\f1\s0" at 0,389 ljust
  7234. "\f(CW\s9\&2\f1\s0" at 44,176 ljust
  7235. line  from 24,128 to 304,128 
  7236. "\f(CW\s9\&...\f1\s0" at 44,113 ljust
  7237. t149 with .nw at 44,88
  7238. "\fI\s9\&e2\f1\s0" at 44,49 ljust
  7239. "\f(CW\s9\&...\f1\s0" at 44,17 ljust
  7240. box ht 416 wid 280 with .nw at 24,688 
  7241. "\fI\s9\&length\f1\s0" at 44,192 ljust
  7242. "\f(CW\s9\&4\f1\s0" at 48,140
  7243. "\fI\s9\&a1  (abbreviation table offset)\f1\s0" at 44,160 ljust
  7244. "\f(CW\s9\&4\f1\s0" at 44,624
  7245. "\fI\s9\&a1  (abbreviation table offset)\f1\s0" at 40,640 ljust
  7246. t205 with .nw at 376,477
  7247. "\fI\s9\&a1:\f1\s0" at 348,657 rjust
  7248. "\fI\s9\&length\f1\s0" at 40,672 ljust
  7249. "\fR\s10\&Abbreviation Table - .debug_abbrev\f1\s0" at 384,678 ljust
  7250. "\fR\s10\&Compilation Unit 1 - .debug_info\f1\s0" at 68,694 ljust
  7251. "\fR\s10\&Compilation Unit 2 - .debug_info\f1\s0" at 64,218 ljust
  7252. "\f(CW\s9\&2\f1\s0" at 44,656
  7253. "\f(CW\s9\&1\f1\s0" at 44,605
  7254. t126 with .nw at 36,599
  7255. line  from 24,616 to 304,616 
  7256. "\f(CW\s9\&2\f1\s0" at 40,461 ljust
  7257. t219 with .nw at 376,359
  7258. line  from 24,96 to 304,96 
  7259. line  from 24,32 to 304,32 
  7260. t109 with .nw at 40,449
  7261. "\fI\s9\&e1\f1\s0" at 40,373 ljust
  7262. "\fI\s9\&e1:\f1\s0" at 0,461 ljust
  7263. line  from 24,480 to 304,480 
  7264. line  from 24,400 to 304,400 
  7265. line  from 24,360 to 304,360 
  7266. line  from 24,304 to 304,304 
  7267. .PE
  7268. .fi
  7269. .DE
  7270. .SK
  7271. .OP
  7272. .HU "Appendix 3 -- Statement Program Examples"
  7273. .P
  7274. Consider this simple source file and the resulting machine code for
  7275. the Intel 8086 processor:
  7276. .DS
  7277. .S -2
  7278. .TS
  7279. ;
  7280. lf(CW) lf(CW) s
  7281. lf(CW) lf(CW) s
  7282. lf(CW) lf(CW) lf(CW)
  7283. lf(CW) lf(CW) lf(CW)
  7284. lf(CW) lf(CW) s
  7285. lf(CW) lf(CW) s
  7286. lf(CW) lf(CW) lf(CW)
  7287. lf(CW) lf(CW) lf(CW)
  7288. lf(CW) lf(CW) lf(CW)
  7289. lf(CW) lf(CW) lf(CW)
  7290. lf(CW) lf(CW) s
  7291. lf(CW) lf(CW) lf(CW)
  7292. lf(CW) lf(CW) lf(CW)
  7293. lf(CW) lf(CW) lf(CW)
  7294. lf(CW) lf(CW) lf(CW)
  7295. lf(CW) lf(CW) s
  7296. lf(CW) lf(CW) lf(CW) 
  7297. lf(CW) lf(CW) lf(CW)
  7298. lf(CW) lf(CW) s
  7299. lf(CW) lf(CW) lf(CW).
  7300. 1:    int
  7301. 2:    main()
  7302.     0x239:    push pb
  7303.     0x23a:    mov bp,sp
  7304. 3:    {
  7305. 4:    printf("Omit needless words\en");
  7306.     0x23c:    mov ax,0xaa
  7307.     0x23f:    push ax
  7308.     0x240:    call _printf
  7309.     0x243:    pop cx
  7310. 5:    exit(0);
  7311.     0x244:    xor ax,ax
  7312.     0x246:    push ax
  7313.     0x247:    call _exit
  7314.     0x24a:    pop cx
  7315. 6:    }
  7316.     0x24b:    pop bp
  7317.     0x24c:    ret
  7318. 7:
  7319.     0x24d:
  7320. .TE
  7321. .S +2
  7322. .DE
  7323. .P
  7324. If the statement program prologue specifies the following:
  7325. .DS
  7326. .S -2
  7327. .TS
  7328. ;
  7329. lf(CW) lf(CW).
  7330. minimum_instruction_length    1
  7331. opcode_base    10
  7332. line_base    1
  7333. line_range    15
  7334. .TE
  7335. .S +2
  7336. .DE
  7337. .P
  7338. Then one encoding of the statement program would occupy 12 bytes
  7339. (the opcode \f(CWSPECIAL(\fIm\fP, \fIn\fP)\fR indicates the special
  7340. opcode generated for a line increment of \fIm\fP and an address increment
  7341. of \fIn\fP):
  7342. .DS
  7343. .S -2
  7344. .TS
  7345. ;
  7346. l l l
  7347. lf(CW) lf(CW) lf(CW).
  7348. Opcode    Operand    Byte Stream
  7349. _
  7350. DW_LNS_advance_pc    LEB128(0x239)    0x2, 0xb9, 0x04
  7351. SPECIAL(2, 0)        0xb
  7352. SPECIAL(2, 3)        0x38
  7353. SPECIAL(1, 8)        0x82
  7354. SPECIAL(1, 7)        0x73
  7355. DW_LNS_advance_pc    LEB128(2)    0x2, 0x2
  7356. DW_LNE_end_sequence        0x0, 0x1, 0x1
  7357. .TE
  7358. .S +2
  7359. .DE
  7360. .P
  7361. An alternate encoding of the same program using standard opcodes to
  7362. advance the program counter would occupy 22 bytes:
  7363. .DS
  7364. .S -2
  7365. .TS
  7366. ;
  7367. l l l
  7368. lf(CW) lf(CW) lf(CW).
  7369. Opcode    Operand    Byte Stream
  7370. _
  7371. DW_LNS_fixed_advance_pc    0x239    0x9, 0x39, 0x2
  7372. SPECIAL(2, 0)        0xb
  7373. DW_LNS_fixed_advance_pc    0x3    0x9, 0x3, 0x0
  7374. SPECIAL(2, 0)        0xb
  7375. DW_LNS_fixed_advance_pc    0x8    0x9, 0x8, 0x0
  7376. SPECIAL(1, 0)        0xa
  7377. DW_LNS_fixed_advance_pc    0x7    0x9, 0x7, 0x0
  7378. SPECIAL(1, 0)        0xa
  7379. DW_LNS_fixed_advance_pc    0x2    0x9, 0x2, 0x0
  7380. DW_LNE_end_sequence        0x0, 0x1, 0x1
  7381. .TE
  7382. .S +2
  7383. .DE
  7384. .SK
  7385. .OP
  7386. .HU "Appendix 4 -- Encoding and decoding variable length data"
  7387. .ta .5i +.5i +.5i +.5i +.5i +.5i +.5i +.5i
  7388. .P
  7389. Here are algorithms expressed in a C-like pseudo-code to encode and decode
  7390. signed and unsigned numbers in LEB128:
  7391. .P
  7392. \fBEncode an unsigned integer:\fP
  7393. .br
  7394. .DS
  7395. .S -2
  7396. \f(CWdo
  7397. {        
  7398.     byte = low order 7 bits of value;
  7399.     value >>= 7;
  7400.     if (value != 0)    /* more bytes to come */
  7401.         set high order bit of byte;
  7402.     emit byte;
  7403. } while (value != 0);\fP
  7404. .S +2
  7405. .DE
  7406. .P
  7407. \fBEncode a signed integer:\fP
  7408. .br
  7409. .DS
  7410. .S -2
  7411. \f(CWmore = 1;
  7412. negative = (value < 0);
  7413. size = no. of bits in signed integer;
  7414. while(more)
  7415. {
  7416.     byte = low order 7 bits of value;
  7417.     value >>= 7;
  7418.     /* the following is unnecessary if the implementation of >>=
  7419.      * uses an arithmetic rather than logical shift for a signed
  7420.      * left operand
  7421.      */
  7422.     if (negative)
  7423.         /* sign extend */
  7424.         value |= - (1 << (size - 7));
  7425.     /* sign bit of byte is 2nd high order bit (0x40) */
  7426.     if ((value == 0 && sign bit of byte is clear) ||
  7427.         (value == -1 && sign bit of byte is set))
  7428.         more = 0;
  7429.     else
  7430.         set high order bit of byte;
  7431.     emit byte;
  7432. }\fP
  7433. .S +2
  7434. .DE
  7435. .SK
  7436. .ta .5i +.5i +.5i +.5i +.5i +.5i +.5i +.5i
  7437. .P
  7438. \fBDecode unsigned LEB128 number:\fP
  7439. .br
  7440. .DS
  7441. .S -2
  7442. \f(CWresult = 0;
  7443. shift = 0;
  7444. while(true)
  7445. {
  7446.     byte = next byte in input;
  7447.     result |= (low order 7 bits of byte << shift);
  7448.     if (high order bit of byte == 0)
  7449.         break;
  7450.     shift += 7;
  7451. }\fP
  7452. .S +2
  7453. .DE
  7454. .P
  7455. \fBDecode signed LEB128 number:\fP
  7456. .br
  7457. .DS
  7458. .S -2
  7459. \f(CWresult = 0;
  7460. shift = 0;
  7461. size = no. of bits in signed integer;
  7462. while(true)
  7463. {
  7464.     byte = next byte in input;
  7465.     result |= (low order 7 bits of byte << shift);
  7466.     shift += 7;
  7467.     /* sign bit of byte is 2nd high order bit (0x40) */
  7468.     if (high order bit of byte == 0)
  7469.         break;
  7470. }
  7471. if ((shift < size) && (sign bit of byte is set))
  7472.     /* sign extend */
  7473.     result |= - (1 << shift);\fP
  7474. .S +2
  7475. .DE
  7476. .SK
  7477. .OP
  7478. .HU "Appendix 5 -- Call Frame Information Examples"
  7479. The following example uses a hypothetical RISC machine in the style of
  7480. the Motorola 88000.
  7481. .BL
  7482. .LI
  7483. Memory is byte addressed.
  7484. .LI
  7485. Instructions are all 4-bytes each and word aligned.
  7486. .LI
  7487. Instruction operands are typically of the form:
  7488. .br
  7489. .DS
  7490.     <destination reg> <source reg> <constant>
  7491. .DE
  7492. .LI
  7493. The address for the load and store instructions is computed by
  7494. adding the contents of the source register with the constant.
  7495. .LI
  7496. There are 8 4-byte registers:
  7497. .br
  7498. .DS
  7499.     R0 always 0
  7500.     R1 holds return address on call
  7501.     R2-R3 temp registers (not preserved on call)
  7502.     R4-R6 preserved on call
  7503.     R7 stack pointer.
  7504. .DE
  7505. .LI
  7506. The stack grows in the negative direction.
  7507. .LE
  7508. .P
  7509. The following are two code fragments from a subroutine 
  7510. called \f(CWfoo\fP that
  7511. uses a frame pointer (in addition to the stack pointer.)  The first
  7512. column values are byte addresses.
  7513. .DS
  7514. .S -2
  7515. .TS
  7516. ;
  7517. lf(CW) lf(CW) s  s
  7518. lf(CW) lf(CW) lf(CW) lf(CW)
  7519. lf(CW) lf(CW) lf(CW) lf(CW)
  7520. lf(CW) lf(CW) lf(CW) lf(CW)
  7521. lf(CW) lf(CW) lf(CW) lf(CW)
  7522. lf(CW) lf(CW) lf(CW) lf(CW)
  7523. lf(CW) lf(CW) s s
  7524. lf(CW) lf(CW) s s
  7525. lf(CW) lf(CW) s s
  7526. lf(CW) lf(CW) lf(CW) lf(CW).
  7527.     ;; start prologue
  7528. foo    sub    R7, R7, <fsize>         ; Allocate frame
  7529. foo+4    store    R1, R7, (<fsize>-4)     ; Save the return address
  7530. foo+8    store    R6, R7, (<fsize>-8)     ; Save R6
  7531. foo+12    add    R6, R7, 0               ; R6 is now the Frame ptr
  7532. foo+16    store    R4, R6, (<fsize>-12)    ; Save a preserve reg.
  7533.     ;; This subroutine does not change R5
  7534.     ...
  7535.     ;; Start epilogue (R7 has been returned to entry value)
  7536. foo+64    load    R4, R6, (<fsize>-12)    ; Restore R4
  7537. foo+68    load    R6, R7, (<fsize>-8)     ; Restore R6
  7538. foo+72    load    R1, R7, (<fsize>-4)     ; Restore return address
  7539. foo+76    add    R7, R7, <fsize>         ; Deallocate frame
  7540. foo+80    jump    R    ; Return
  7541. foo+84
  7542. .TE
  7543. .S +2
  7544. .DE
  7545. .SK
  7546. The table for the \f(CWfoo\fP subroutine is as follows.  
  7547. It is followed by the
  7548. corresponding fragments from the 
  7549. .Cf .debug_frame 
  7550. section.
  7551. .DS
  7552. .S -2
  7553. .TS
  7554. tab(|);
  7555. lf(CW) lf(CW) lf(CW) lf(CW) lf(CW) lf(CW) lf(CW) lf(CW) lf(CW) lf(CW) lf(CW).
  7556. Loc|CFA|R0|R1|R2|R3|R4|R5|R6|R7|R8
  7557. foo|[R7]+0|s|u|u|u|s|s|s|s|r1
  7558. foo+4|[R7]+fsize|s|u|u|u|s|s|s|s|r1
  7559. foo+8|[R7]+fsize|s|u|u|u|s|s|s|s|c4
  7560. foo+12|[R7]+fsize|s|u|u|u|s|s|c8|s|c4
  7561. foo+16|[R6]+fsize|s|u|u|u|s|s|c8|s|c4
  7562. foo+20|[R6]+fsize|s|u|u|u|c12|s|c8|s|c4
  7563. ...
  7564. foo+64|[R6]+fsize|s|u|u|u|c12|s|c8|s|c4
  7565. foo+68|[R6]+fsize|s|u|u|u|s|s|c8|s|c4
  7566. foo+72|[R7]+fsize|s|u|u|u|s|s|s|s|c4
  7567. foo+76|[R7]+fsize|s|u|u|u|s|s|s|s|r1
  7568. foo+80|[R7]+0|s|u|u|u|s|s|s|s|r1
  7569. .TE
  7570. .TS
  7571. ;
  7572. l s
  7573. l l.
  7574. notes:
  7575. 1.    R8 is the return address
  7576. 2.    s = same_value rule
  7577. 3.    u = undefined rule
  7578. 4.    rN = register(N) rule
  7579. 5.    cN = offset(N) rule
  7580. .sp
  7581. .sp
  7582. .TE
  7583. .S +2
  7584. .DE
  7585. .P
  7586. Common Information Entry (CIE):
  7587. .DS
  7588. .S -2
  7589. .TS
  7590. ;
  7591. lf(CW) lf(CW) lf(CW).
  7592. cie    32    ; length
  7593. cie+4    0xffffffff    ; CIE_id
  7594. cie+8    1     ; version
  7595. cie+9    0    ; augmentation
  7596. cie+10    4    ; code_alignment_factor
  7597. cie+11    4    ; data_alignment_factor
  7598. cie+12    8    ; R8 is the return addr.
  7599. cie+13    DW_CFA_def_cfa (7, 0)    ; CFA = [R7]+0
  7600. cie+16    DW_CFA_same_value (0)    ; R0 not modified (=0)
  7601. cie+18    DW_CFA_undefined (1)    ; R1 scratch
  7602. cie+20    DW_CFA_undefined (2)    ; R2 scratch
  7603. cie+22    DW_CFA_undefined (3)    ; R3 scratch
  7604. cie+24    DW_CFA_same_value (4)    ; R4 preserve
  7605. cie+26    DW_CFA_same_value (5)    ; R5 preserve
  7606. cie+28    DW_CFA_same_value (6)    ; R6 preserve
  7607. cie+30    DW_CFA_same_value (7)    ; R7 preserve
  7608. cie+32    DW_CFA_register (8, 1)    ; R8 is in R1
  7609. cie+35    DW_CFA_nop    ; padding
  7610. cie+36
  7611. .TE
  7612. .S +2
  7613. .DE
  7614. .SK
  7615. .P
  7616. Frame Description Entry (FDE):
  7617. .DS
  7618. .S -2
  7619. .TS
  7620. ;
  7621. lf(CW) lf(CW) lf(CW).
  7622. fde    40    ; length
  7623. fde+4    cie    ; CIE_ptr
  7624. fde+8    foo    ; initial_location
  7625. fde+12    84    ; address_range
  7626. fde+16    DW_CFA_advance_loc(1)    ; instructions
  7627. fde+17    DW_CFA_def_cfa_offset(<fsize>/4)    ; assuming <fsize> < 512
  7628. fde+19    DW_CFA_advance_loc(1)
  7629. fde+20    DW_CFA_offset(8,1)
  7630. fde+22    DW_CFA_advance_loc(1)
  7631. fde+23    DW_CFA_offset(6,2)
  7632. fde+25    DW_CFA_advance_loc(1)
  7633. fde+26    DW_CFA_def_cfa_register(6)
  7634. fde+28    DW_CFA_advance_loc(1)
  7635. fde+29    DW_CFA_offset(4,3)
  7636. fde+31    DW_CFA_advance_loc(11)
  7637. fde+32    DW_CFA_restore(4)
  7638. fde+33    DW_CFA_advance_loc(1)
  7639. fde+34    DW_CFA_restore(6)
  7640. fde+35    DW_CFA_def_cfa_register(7)
  7641. fde+37    DW_CFA_advance_loc(1)
  7642. fde+38    DW_CFA_restore(8)
  7643. fde+39    DW_CFA_advance_loc(1)
  7644. fde+40    DW_CFA_def_cfa_offset(0)
  7645. fde+42    DW_CFA_nop    ; padding
  7646. fde+43    DW_CFA_nop    ; padding
  7647. fde+44
  7648. .TE
  7649. .S +2
  7650. .DE
  7651. .S +1
  7652.  
  7653. '\"
  7654. '\"  Table of Contents stuff
  7655. '\"
  7656. .de TP
  7657. .sp 4
  7658. ..
  7659. .VM
  7660. .de TY
  7661. .ce 1
  7662. Table of Contents
  7663. .sp
  7664. ..
  7665. .nr Lf 1
  7666. .ds Lf List of Figures
  7667. .SK
  7668. .TC 1 1 7 0
  7669.